2007.01.04 17:51 "[Tiff] Access to bare libtiff codecs?", by John Aldridge

2007.01.04 18:02 "Re: [Tiff] Access to bare libtiff codecs?", by Lee Howard

We've got a requirement to create (from an array of bits) a CCITT Group 3 or 4 encoded data stream which is /not/ wrapped up in a TIFF file, and I wondered whether libtiff (which we already use for other reasons) could do this.

We could, I think, do this by creating a temporary TIFF file of the right format, calling TIFFWriteEncodedStrip to encode the data, and then calling TIFFReadRawStrip to get the encoded data back, but is there an easier way?

That' is the method, essentially, that HylaFAX follows. However HylaFAX has its own G3/G4 encoder and decoder which it can use to re-encode data on-the-fly (without using a TIFF file). This encoder is not that dissimilar from the one in libtiff as they both started from the same author and share an identical license and much of the same code.

So - yes, you could link directly in to the libtiff or HylaFAX source code to achieve your requirement without writing it to TIFF. But if you want to use the libtiff API I think that you'll need to use the approximate method you describe. At least, I don't know of any entirely in-memory TIFF-encode API functions. Of course, I'm no libtiff expert.