PDA

View Full Version : TIF File Properties & Control



Jim Mulenos
20-Apr-2020, 09:19 AM
We have just begun working with the Dataflex Graphics Library 3.03 with DF 19.1, it looks great (thanks Vincent) and we have a few basic questions.

Our first task is to replace an older control used to look at incoming faxes stored as multi-page TIF files. We are using the cImageContainer to successfully view, rotate, zoom in/out, and retrieve properties. We have failed however to find examples and/or figure out how to do the following:

PAGE CONTROL (to deal with multi-page images)- Retrieve Total Page Count
- Retrieve Current Page #
- Go To Next Page
- Go To Previous Page

DISPLAY CONTROL (to deal with visual inconsistencies inherent in fax transmissions)- Increase Image Brightness
- Decrease Image Brightness

Our guess from HELP is that this involves the USE of wrapper classes such as cGDIImage, however which classes and how to begin to use them escapes us.

Vincent Oorsprong
24-Apr-2020, 07:41 AM
Jim,

I've not tested while writing this reply but I am quite sure the multi page TIFF files are similar to animated GIFs and after loading the piFrameCount will be set.

I have no experience with in- or decrease of the image brightness but I think you can do this as you can make many changes via the GDI+ methods.

Jim Mulenos
25-Apr-2020, 09:59 AM
Thanks for the thought Vincent. After spending a few more hours digging into this possibility using example source code for bitmaps it appears that the ConfigureMultiFrameDisplay procedure within the cGDIImage class does not properly set piFrameCount or other properties when a multi-page TIF(F) file is the source object.

Please let me know if we've missed something important in the examples or help. Getting and setting the following multi-page TIF(F) image properties is our goal; any clues you can provide would be greatly appreciated:

Get Total # of Pages
Get Current Page Viewed
Set & View Next Page
Set & View Previous Page
Set & View New Current Page by #

Note: Forum rules blocked example TIF file upload attempt. Rename to (allowable) TIFF returned image x/y size error on re-upload attempt. I am happy to directly email you an example TIF if you wish.

Stephen W. Meeley
26-Apr-2020, 07:36 AM
Jim,

Perhaps just zip up the original TIF file to attach.

Jim Mulenos
27-Apr-2020, 10:15 AM
Thanks for the solution Stephen. Attached are:

- a simplified actual 5-page received fax in TIF format (zipped), plus,
- a JPG snip of DF19.1 utilizing the very old (!) Image Viewer control we are looking to replace with Dataflex Graphics Library controls

Multi-page TIF files are still with us. And to deal with them we will need to be able to deal with individual pages and with contrast/brightness quality issues. We are hoping that the Dataflex Graphics Library is the answer. Thanks!

Vincent Oorsprong
28-Apr-2020, 10:09 AM
Jim

Will look into this.

Vincent Oorsprong
29-Apr-2020, 04:24 AM
Jim,

I found the problem. The SelectNextFrame method work only on animated GIF files. I've added a routine to advance to the next or previous page of a multi page TIFF file to the class.

I hope to be able to update the Graphics Library installer this afternoon

Vincent Oorsprong
29-Apr-2020, 05:12 AM
Jim, others,

New version 3.0.4 now available for download via your Data Access ID.

Jim Mulenos
29-Apr-2020, 08:09 AM
Thanks Vincent, I'll give this a try and let you know. In appreciation,

Jim Mulenos
6-May-2020, 02:10 PM
Working great Vincent. Thank you

Jim Mulenos
15-May-2020, 08:18 AM
Vincent, great progress in using the Graphics Library. One interesting issue we've been working thru with this: After rotating any page of a multi-page TIF using RotateImage, paging with DisplayNextPage and DisplayPreviousPage stops working.

Vincent Oorsprong
18-May-2020, 03:12 AM
Jim,

I can see the behavior. The image format is converted from TIFF (gpImageFormatTIFF) to a memory bitmap (gpImageFormatMemoryBMP).

Googling on this behavior I found: https://stackoverflow.com/questions/34185356/rotate-image-and-view-next-page and that confirms the change. They suggest we make a copy of the image before rotating and display that information. On next or previous page go back to the original file. I guess that is doable but I think quite difficult to implement this in the generic classes as when this happens with a RotateImage would it do the same for one or more other functions. And what to do with a save operation? I bet you want to have the rotated image being saved back in the multi page TIFF file at the original spot.

Jim Mulenos
19-May-2020, 12:56 PM
Thanks for confirming and your guidance Vincent, I agree. I see this same behavior in the Windows image viewer...rotate page 1, hit next page, and it un-rotates. The workaround you suggested is already in place using the new Dataflex Graphics Library controls; what we've implemented is: If page 1 is rotated and the user hit's next page, we re-display the original image (which of course defaults to page 1, un-rotated), increment the page then rotate it. It's not pretty, it works, and thank goodness we don't have to save it rotated. Yet!

Jim Mulenos
18-Jun-2020, 10:45 AM
Attached is a JPG and our code for a DF 19.1 multi-page TIF viewer using the latest version of Vincent's Dataflex Graphics Library. It's been in production for a few weeks now; so far so good.