disable chroma subsample in jpeg-tiff if Q>=90

see https://github.com/jcupitt/libvips/issues/218
This commit is contained in:
John Cupitt 2015-01-19 22:01:13 +00:00
parent c805b382fe
commit dbd98ba86c
2 changed files with 9 additions and 3 deletions

View File

@ -9,6 +9,7 @@
- renamed VIPS_FOREIGN_DZ_DEPTH_1 as VIPS_FOREIGN_DZ_DEPTH_ONE etc. to help
bindings
- vipsthumbnail will return an error code if one or more conversions failed
- disable chroma subsample in jpeg-tiff if Q >= 90
24/12/14 started 7.42.1
- add gobject-2.0 to Requires: in vips and vips-cpp .pc files

View File

@ -144,6 +144,8 @@
* - embed XMP in output
* 10/12/14
* - zero out edge tile buffers before jpeg write, thanks iwbh15
* 19/1/15
* - disable chroma subsample if Q >= 90
*/
/*
@ -575,7 +577,7 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height )
else if( tw->compression == COMPRESSION_JPEG &&
tw->im->Bands == 3 &&
tw->im->BandFmt == VIPS_FORMAT_UCHAR &&
!tw->rgbjpeg ) {
(!tw->rgbjpeg && tw->jpqual < 90) ) {
/* This signals to libjpeg that it can do
* YCbCr chrominance subsampling from RGB, not
* that we will supply the image as YCbCr.
@ -1493,8 +1495,11 @@ tiff_copy( TiffWrite *tw, TIFF *out, TIFF *in )
tw->im->BandFmt == VIPS_FORMAT_UCHAR ) {
/* Enable rgb->ycbcr conversion in the jpeg write.
*/
TIFFSetField( out,
TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB );
if( !tw->rgbjpeg &&
tw->jpqual >= 90 )
TIFFSetField( out,
TIFFTAG_JPEGCOLORMODE,
JPEGCOLORMODE_RGB );
/* And we want ycbcr expanded to rgb on read. Otherwise
* TIFFTileSize() will give us the size of a chrominance