2011.04.19 20:51 "[Tiff] Pink images", by Sergius Bobrovsky

Hello!

I'm working with some OJPEG-in-TIFF images. Basically, I try to recompress them into deflated TIFF images. The problem is: the images come out pink (i.e. like translucent pink layer was put on them).

I guess this is because of mishmash with YCBCR and RGB colorpaces. tiffdump shows following info for one of the source images:

Directory 6: offset 134862 (0x20ece) next 310223 (0x4bbcf)
ImageWidth (256) SHORT (3) 1<2205>
ImageLength (257) SHORT (3) 1<1730>
BitsPerSample (258) SHORT (3) 3<8 8 8>
Compression (259) SHORT (3) 1<6>
FillOrder (266) SHORT (3) 1<1>
Photometric (262) SHORT (3) 1<6>
StripOffsets (273) LONG (4) 1<135154>
SamplesPerPixel (277) SHORT (3) 1<3>
RowsPerStrip (278) LONG (4) 1<1730>
StripByteCounts (279) LONG (4) 1<175069>
XResolution (282) RATIONAL (5) 1<200>
YResolution (283) RATIONAL (5) 1<200>
ResolutionUnit (296) SHORT (3) 1<2>
JPEGProcessingMode (512) SHORT (3) 1<1>
JPEGInterchangeFormat (513) LONG (4) 1<135154>
JPEGInterchangeFormatLength (514) LONG (4) 1<175069>
YCbCrSubsampling (530) SHORT (3) 2<1 2>

I am using TIFFReadRGBAImageOriented/ TIFFWriteScanline methods to convert images. I don't mind to postprocess images to remove pink colors. Can anyone please tell me how can I change ratser returned by TIFFReadRGBAImageOriented in order to remove pink colors?

--
Sergius Bobrovsky