JPG subsampling in TIFF
Posted: 2010-09-16T07:02:12-07:00
I think, 'normal RGB' as JPG in TIFF doesn't use subsampling at all (correct me if I'm wrong). But the subsampling can still be set in ImageMagick and a redundant YCbCrSubSampling tag is written:
I rather use ExifTool this time (to show that the false subsampling values are not written as comment or something like that, but as real YCbCrSubSampling tag):
exiftool -S -YCbCrSubSampling logo_rgb.tif
YCbCrSubSampling: YCbCr4:2:0 (2 2)
exiftool -S -YCbCrSubSampling logo_rgb2.tif
YCbCrSubSampling: Unknown (10 1)
Contrary to that, when the JPG in TIFF is written as YCbCr, subsampling theoretically should be possible. But here, the subsampling value (and the value for the YCbCrSubSampling tag) is hardcoded to 1x1:exiftool -S -YCbCrSubSampling logo_ycbcr.tif
YCbCrSubSampling: YCbCr4:4:4 (1 1)
With CMYK and grayscale colorspaces, the real subsampling is again set to 1x1. (For grayscale, a different subsampling value would be useless anyway.) But a YCbCrSubSampling tag is written - always with the default 2x2 subsampling value:exiftool -S -YCbCrSubSampling logo_cmyk.tif
YCbCrSubSampling: YCbCr4:2:0 (2 2)
exiftool -S -YCbCrSubSampling logo_gray.tif
YCbCrSubSampling: YCbCr4:2:0 (2 2)
So.. Perhaps the YCbCrSubSampling tag for JPG in TIFF should be omitted if the colorspace is not YCbCr? (And maybe other sampling-factors than 1x1 could be allowed for the YCbCr colorspace?)
Code: Select all
convert logo: -compress jpeg logo_rgb.tif
convert logo: -compress jpeg -sampling-factor 10x1 logo_rgb2.tif
exiftool -S -YCbCrSubSampling logo_rgb.tif
YCbCrSubSampling: YCbCr4:2:0 (2 2)
exiftool -S -YCbCrSubSampling logo_rgb2.tif
YCbCrSubSampling: Unknown (10 1)
Contrary to that, when the JPG in TIFF is written as YCbCr, subsampling theoretically should be possible. But here, the subsampling value (and the value for the YCbCrSubSampling tag) is hardcoded to 1x1:
Code: Select all
convert logo: -colorspace YCbCr -compress jpeg logo_ycbcr.tif
YCbCrSubSampling: YCbCr4:4:4 (1 1)
With CMYK and grayscale colorspaces, the real subsampling is again set to 1x1. (For grayscale, a different subsampling value would be useless anyway.) But a YCbCrSubSampling tag is written - always with the default 2x2 subsampling value:
Code: Select all
convert logo: -colorspace cmyk -compress jpeg logo_cmyk.tif
convert logo: -colorspace gray -compress jpeg logo_gray.tif
YCbCrSubSampling: YCbCr4:2:0 (2 2)
exiftool -S -YCbCrSubSampling logo_gray.tif
YCbCrSubSampling: YCbCr4:2:0 (2 2)
So.. Perhaps the YCbCrSubSampling tag for JPG in TIFF should be omitted if the colorspace is not YCbCr? (And maybe other sampling-factors than 1x1 could be allowed for the YCbCr colorspace?)