2009.12.10 18:28 "[Tiff] YCbCr", by Steve Mills

2009.12.10 20:32 "Re: [Tiff] YCbCr", by

Steve,

Are you using the JPEG_COLORMODE pseudo-tag?

No. But I just added this call right after our call to TIFFClientOpen and it worked!

TIFFSetField(m_TIFF, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);

Is that the correct way to handle this?

It does, in the sense that it is LibTiff's wrong way to try and support the result that you're after in this particular case. Do thorough testing, and if it works for you, it works for you.

So, what you were getting was not channel-order-inversed RGB, but YCbCr, actually. And that is what the Photometric said you'd get. Only if the Photometric is YCbCr, and the compression is JPEG, can you suddenly turn this into RGB by using this magical out-of-the-blue pseudo-tag. But you'll have to remember to have your code thoroughly check for these conditions, and use the magical pseudo-tag.

Best regards,

Joris