2001.12.25 03:35 "Re: Where is the best place to find compression algorithm", by Jon Saxton
I'll second that- I'm close enough with my old tiff program that incorporating the whole tifflib would probably be more effort than just rolling my own for these two cases.
About three years ago I needed to strip extraneous white space from some G4 images and at the time I searched around the internet for a while to locate information. Descriptions of the algorithms are fairly easy to get but source code is a different story. I had my own TIFF handling code in C++, completely independent of libtiff but I found that the easiest route was to very carefully tease out the G3/G4 codecs from the libtiff sources and incorporate those into my code. The exposed interface contained just three routines, Fax4Encode(), Fax4Decode() and Fax3PreDecode() along with a somewhat stripped-down codec state block. I didn't do the extra step and build a class to encapsulate everything but at least now I can decode, manipulate and encode all in memory. The whole exercise took maybe 3-4 days but in the end it was well worth the effort. The beauty of the libtiff code is that it has been around for a long time now. In particular, the G3/G4 codecs are very stable and probably thoroughly debugged. Rolling your own might turn out to be more difficult.
Jon Saxton <firstname.lastname@example.org> OS/2 software developer
U.S. agent for Triton Technologies International Ltd