TIFF File Issues |
Top Previous Next |
Changing/specifying compression type used on each TIFF page
Since TIFF files can have multiple pages, DTWAIN allows your application to change the TIFF compression used for each page when acquiring to a multipage TIFF file. The application must set up notification processing to take advantage of this feature.
By default, when a multi-page TIFF file is acquired, the TIFF type specified in the call to DTWAIN_AcquireFile or DTWAIN_AcquireFileEx is the type that's used for all the pages in the TIFF file. For most applications, this behavior is adequate (the TIFF file has all pages consisting of one compression type). However, there are valid cases where the application may want to store each page in the TIFF file using the best compression available for the type of image that is stored. This results in smaller TIFF files.
For example, assume that page 1 is a black and white (1 bit per pixel) image, and that page 2 is a 24-bit color image. Since page 1 is a b/w image, it is better to acquire this page as a Group 3 or Group 4 fax type, since these compression types produce the smallest images in terms of size. The second page can use the LZW or JPEG compression, since LZW and JPEG compression are very good at compressing color images (while Group 3 and Group 4 compression only works for black/white images).
When the DTWAIN_TN_TRANSFERREADY or DTWAIN_TN_TRANSFERDONE notifications are sent to your application, you can call the DTWAIN_SetTIFFCompressType function to set the compression for that page. To determine what type of image will be acquired, you can call DTWAIN_GetImageInfo when the DTWAIN_TN_TRANSFERREADY or DTWAIN_TN_TRANSFERDONE and inspect the returned bits-per-pixel value. Depending on the bits-per-pixel value, call DTWAIN_SetTIFFCompressType.
JPEG-in-TIFF (TIFF-JPEG) files
If you're saving the file to TIFF-JPEG format, please note that DTWAIN saves these files in the new TIFF-JPEG format, as opposed to the older, buggy TIFF-JPEG format that many viewers still support. If you have an image viewer that only views TIFF-JPEG files that have been saved in the old format, please contact the creator of the software and kindly suggest that they support the newer TIFF-JPEG format. The older format has been officially been out of support from Adobe, the creators of the TIFF format. All viewers should now use the newer format.
|