2011.09.05 10:01 "Re: [Tiff] Too big size of TIFF with JPEG compression", by
On 5 September 2011 03:27, <email@example.com> wrote:
I found, that TIFF with JPEG compression is almost three times larger, than regular JPEG (RGB with the same quality)
What is a reason, and how to fix it.
By default, libtiff does not enable YCbCr chrominance subsampling when it writes with jpeg compression. This is because you can use jpeg compression on tiff files for which chrominance subsampling is not appropriate, for example CMYK.
If you are writing a file where you know that chrominance subsampling is a good idea, you need to set TIFFTAG_JPEGCOLORMODE to JPEGCOLORMODE_RGB, and TIFFTAG_PHOTOMETRIC to PHOTOMETRIC_YCBCR.
You don't need to do the conversion to YCbCR yourself, libjpeg will do this for you, you just supply RGB. The tag simply signals that you'd like this conversion done.
When you read the file back again, you'll need to signal that you'd like the ycbcy->rgb conversion done for you by setting TIFFTAG_JPEGCOLORMODE to JPEGCOLORMODE_RGB on the read.