YCbCr in TIFF
Posted: 2010-09-16T07:50:48-07:00
Reading YCbCr:
There seems to be a minor issue with the photometric info in identify. When reading YCbCr in TIFF, the PHOTOMETRIC_YCBCR case (photometric value 6) is missing, and so it defaults to "unknown":exiftool -S -PhotometricInterpretation test_ycbcr.tif
PhotometricInterpretation: YCbCr
identify -verbose test_ycbcr.tif
...
tiff:photometric: unknown
Writing YCbCr:
One should be able to store YCbCr in TIFF with LZW compression, right? That works e.g. with the rose image:exiftool -S -PhotometricInterpretation -Compression rose-ycbcr-lzw.tif
PhotometricInterpretation: YCbCr
Compression: LZW
convert rose-ycbcr-lzw.tif rose.jpg
But e.g. with the logo image (less than 256 colors), it fails. The photometric value is set to palette (and besides, even here, the YCbCrSubSampling tag is written):exiftool -S -PhotometricInterpretation -Compression logo-ycbcr-lzw.tif
PhotometricInterpretation: RGB Palette
Compression: LZW
convert logo-ycbcr-lzw.tif logo.jpg
I can only read such an image with a bad workaround:
convert logo-ycbcr-lzw.tif -set colorspace YCbCr -colorspace RGB logo2.jpg
There seems to be a minor issue with the photometric info in identify. When reading YCbCr in TIFF, the PHOTOMETRIC_YCBCR case (photometric value 6) is missing, and so it defaults to "unknown":
Code: Select all
convert logo: -colorspace ycbcr -compress jpeg test_ycbcr.tif
PhotometricInterpretation: YCbCr
identify -verbose test_ycbcr.tif
...
tiff:photometric: unknown
Writing YCbCr:
One should be able to store YCbCr in TIFF with LZW compression, right? That works e.g. with the rose image:
Code: Select all
convert rose: -colorspace ycbcr -compress lzw rose-ycbcr-lzw.tif
PhotometricInterpretation: YCbCr
Compression: LZW
convert rose-ycbcr-lzw.tif rose.jpg
But e.g. with the logo image (less than 256 colors), it fails. The photometric value is set to palette (and besides, even here, the YCbCrSubSampling tag is written):
Code: Select all
convert logo: -colorspace ycbcr -compress lzw logo-ycbcr-lzw.tif
PhotometricInterpretation: RGB Palette
Compression: LZW
convert logo-ycbcr-lzw.tif logo.jpg
I can only read such an image with a bad workaround:
convert logo-ycbcr-lzw.tif -set colorspace YCbCr -colorspace RGB logo2.jpg