[Gdal-dev] Writing 8-bit TIFFs using JPEG compression

Ray Gardener rayg at daylongraphics.com
Sat May 19 01:28:11 EDT 2007


Frank Warmerdam wrote:
> Ray,
> 
> I just tried it and it seemed to work, though I see the following
> debug message, which I find suspicious:
> 
> GTiff: Setting JPEGCOLORMODE_RGB
> 
> Some of the jpeg stuff is very sensitive to the version of libtiff.  Are 
> you
> using the builtin libtiff?  The last public release?  libtiff-3.9 from CVS?

This is with the built-in libtiff in 1.3.2. I didn't find any tiff 
driver refs to JCS_GRAYSCALE in 1.4.1 but I should revisit the issue 
when I've had a chance to upgrade.

Another thing I noticed that might be a higher-level problem is that if 
the tiff copycreate() gets a color table from a one-band dataset, it 
assumes rgb. But 8-bit formats w/o an explicit gray mode need color 
tables to emulate it, and there's no way to tell which is which except 
to fabricate a driver properties list ahead of time. A simple fix would 
be to have the driver examine the color table and if it sees that it's 
grayscale, then switch to gray mode.

Ray



More information about the Gdal-dev mailing list