diff --git a/ChangeLog b/ChangeLog index 62fe3419..d747a365 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,7 @@ magic number [przemyslawpluta] - disable Orc if building with CET [lovell] - fix vipsthumbnail with pyr tiff [kleisauke] - text autofit could occasionally terminate early [levmorozov] +- fewer warnings on tiffload [chregu] 21/9/18 started 8.8.0 - much faster smartcrop [lovell] diff --git a/libvips/foreign/tiff2vips.c b/libvips/foreign/tiff2vips.c index 6d0d5430..b7b20689 100644 --- a/libvips/foreign/tiff2vips.c +++ b/libvips/foreign/tiff2vips.c @@ -254,6 +254,7 @@ typedef struct _RtiffHeader { gboolean separate; int orientation; gboolean premultiplied; + uint16 compression; /* Result of TIFFIsTiled(). */ @@ -1331,9 +1332,12 @@ rtiff_set_header( Rtiff *rtiff, VipsImage *out ) uint32 data_length; void *data; - /* Request YCbCr expansion. + /* Request YCbCr expansion. libtiff complains if you do this for + * non-jpg images. */ - TIFFSetField( rtiff->tiff, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB ); + if( rtiff->header.compression == COMPRESSION_JPEG ) + TIFFSetField( rtiff->tiff, + TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB ); out->Xsize = rtiff->header.width; out->Ysize = rtiff->header.height * rtiff->n; @@ -2074,7 +2078,6 @@ rtiff_header_read( Rtiff *rtiff, RtiffHeader *header ) { uint16 extra_samples_count; uint16 *extra_samples_types; - uint16 compression; if( !tfget32( rtiff->tiff, TIFFTAG_IMAGEWIDTH, &header->width ) || !tfget32( rtiff->tiff, TIFFTAG_IMAGELENGTH, &header->height ) || @@ -2088,8 +2091,8 @@ rtiff_header_read( Rtiff *rtiff, RtiffHeader *header ) return( -1 ); TIFFGetFieldDefaulted( rtiff->tiff, - TIFFTAG_COMPRESSION, &compression ); - if( compression == COMPRESSION_JPEG ) + TIFFTAG_COMPRESSION, &header->compression ); + if( header->compression == COMPRESSION_JPEG ) /* We want to always expand subsampled YCBCR images to full * RGB. */