TIFF and LibTiff Mail List Archive


2000.02.09 22:01 "OJPEG_SUPPORT?", by Michael O'Rourke
2000.02.22 03:21 "Re: New to this list", by
2000.02.22 13:39 "Re: New to this list", by Helge Blischke
2000.02.23 23:13 "Re: New to this list", by
2000.02.23 11:27 "Re: New to this list", by

2000.02.23 23:13 "Re: New to this list", by

To:   Daniel McCoy <>
cc:   Rainer Wiesenfarth <>,

Excellent! This is the quality of answer I have been seeking all along...

Thanks you,


Daniel McCoy <> on 24/02/2000 04:08:12 am

To: Michael Still, Rainer Wiesenfarth <>


Subject: Re: New to this list

> [...] 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 >file use TIFFClientOpen to redirect the output.

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.)