2012.12.18 20:56 "[Tiff] decoding tiff images with ycbcr and jpeg compression", by swagat mishra

2012.12.19 16:04 "Re: [Tiff] decoding tiff images with ycbcr and jpeg compression", by swagat mishra

sorry for the triple post. I wasnt seeing it being successfully posted and kept retrying...my bad.

I am trying to use TiffReadRGBAImage as i always need the output in 32 bpp rgba and dont need the fine grained control offered by TiffReadEncodedStrip. Shouldnt using TIFFSetField( tiff, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB ), work with TiffReadrgbaImage as well, as it uses TiffReadEncodedStrip in the background?

Or is there any other way to hack this functionality into TiffReadRgbaImage? On Wed, Dec 19, 2012 at 8:28 PM, Bob Friesenhahn < bfriesen@simple.dallas.tx.us> wrote:

> hi,

I am trying to decode the quad-jpeg.tif image with the TiffReadRgbaImage
interface. My libtiff version is 4.0.2 and it is compiled with support for
jpeg,lzw,libz and other compression schemes.
TiffReadRgbaImage returns true but i get a completely black image,instead
of the actual image.

>> I went through previous posts on the mailing list and it seems this is a

bug in 4.x.x. Suggested fix

was to set tiff tag JPEGCOLORMODE to RGB. However that did not work.

Can anyone help me with this?

I see that you have now posted your email three times already. Your email does get through. It is just that no one has responded.

Using GraphicsMagick and libtiff 4.0.3 I am able to load quad-jpeg.tif without any problems. While TIFFReadRGBAImage() may be simple to use, it does not support all TIFF subformats.

For this file, GraphicsMagick uses TIFFReadEncodedStrip(). It does use this hack to cause libjpeg to do the conversion from ycbcr to RGB:


After applying this hack, the subsequent code should behave as if the image uses PHOTOMETRIC_RGB rather than PHOTOMETRIC_YCBCR.

> bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/** > users/bfriesen/ <http://www.simplesystems.org/users/bfriesen/>

GraphicsMagick Maintainer, http://www.GraphicsMagick.org/