2000.02.23 18:08 "Re: New to this list", by Daniel McCoy
I want to be able to do
the conversion in memory, without the intermediate file.
The code for the g4 compression within libtiff is somewhat undocumented, and I was hoping to have this clarified.
>What might be a solution for you:
>Use the approach of tiffcp (or Bjorn), but instead of writing to a real use TIFFClientOpen to redirect the output. >file
Good advice from Rainer.
In case you're not familiar with it, TIFFClientOpen would allow you to essentially establish callbacks so that the g4 compression code would call your routines whenever it wanted to do file i/o operations. So you don't have to know anything about the g4 compression internals to do this.
If I remember right, you needed to get a g4 TIFF file, possibly in strips, into a single g4 encoded buffer in memory.
Open the input file normally, open the output file with TIFFClientOpen, copy the essential tag values from input to output, but make sure to set the output compression to g4 and to set rows per strip for the output file to something larger than the image. Then just read the image from the input file and write it to the output (simplest to write would probably be a scanline oriented loop). The seek,write,etc routines you specified in TIFFClientOpen need to maintain the file image in a memory buffer.
If you need just the g4 image data and not the rest of the TIFF file structure, it would be relatively easy to scan the file buffer and follow the tags necessary to find image data.
Daniel McCoy Pixar
(Rumours of this list's death have been greatly exaggerated.)