| AWARE [SYSTEMS] | Imaging expertise for the Delphi developer | |||||||
![]() |
TIFF and LibTiff Mailing List Archive | |||||||
LibTiff Mailing List
TIFF and LibTiff Mailing List Archive Contact
The TIFF Mailing List Homepage |
Thread1999.12.07 14:53 "Re Deflate - Patch for libtiff", by Ivo PenzarToday I wrote:
> Redefine the COMPRESSION_DEFLATE from 32946 to 8 and use the tiffcp tool
(for example) to
> save the TIFF image with ZIP/Deflate compression, and both Photoshop and
> ImageReady will quietly open this TIFF image just like any other regular
> TIFF file.
There is a better way, a patch for the libtiff to support BOTH the old
value=32946 and the new value=8:
1) In the file tiff.h find the following line (beginning of TIFF Tag
Definitions):
#define COMPRESSION_DEFLATE 32946 /* Deflate compression */
and add a new one right after this:
#define COMPRESSION_ADOBE_DEFLATE 8 /* Deflate compression, as
recognized by Adobe */
2) In the file tif_codec.c find the following line (definition of TIFFCodec
_TIFFBuiltinCODECS[] variable)
{ "Deflate", COMPRESSION_DEFLATE, TIFFInitZIP },
and add a new one right after this:
{ "AdobeDeflate", COMPRESSION_ADOBE_DEFLATE, TIFFInitZIP },
3) In the file tif_zip.c find the following line (implementation of
TIFFInitZIP() method)
assert(scheme == COMPRESSION_DEFLATE);
and replace it with the following one:
assert((scheme == COMPRESSION_DEFLATE) || (scheme ==
COMPRESSION_ADOBE_DEFLATE));
That's it!
> Otherwise, use ACDC (for example) to convert the TIFF image to
> the ZIP/Deflate compression, open that file by your favorite HEX editor
> (mine is A.X.E.), and find the raw byte sequence of 0x010300030000000180b2
> (MM), or 0x0301030001000000b280 (II) and change it to
0x01030003000000010008
> or 0x03010300010000000800 respectively; the image is ready again to be
> quietly opened by Photoshop 5.5 or ImageReady 2.0.
Explanation: find and replace tag 259, value=32946 to value=8. I opted to
search for all 10 bytes (the whole signature of compression tag) to avoid
possible other instances of two-bytes sequence 0x80b2 (MM), i.e., 0xb208
(II).
Ivo
|
|||||||