diff --git a/ChangeLog b/ChangeLog index cd7a12ed..eb1986af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,7 @@ - added VIPS_COUNT_PIXELS(), overcomputation tracking - @out_format in vips_system() can contain [options] - webpsave_buffer no longer ignores @lossless, thanks aaron42net +- float tiff tagged as scRGB to match photoshop convention, thanks Murat 24/3/16 started 8.2.4 - fix nohalo and vsqbs interpolators, thanks Rafael diff --git a/libvips/foreign/tiff2vips.c b/libvips/foreign/tiff2vips.c index dc45bb02..1c58bd61 100644 --- a/libvips/foreign/tiff2vips.c +++ b/libvips/foreign/tiff2vips.c @@ -162,6 +162,9 @@ * - load photoshop metadata * 21/12/15 * - load TIFFTAG_IMAGEDESCRIPTION + * 11/4/16 + * - non-int RGB images are tagged as scRGB ... matches photoshop + * convention */ /* @@ -688,7 +691,8 @@ parse_greyscale( ReadTiff *rtiff, VipsImage *out ) return( -1 ); out->Bands = rtiff->samples_per_pixel; - if( (out->BandFmt = guess_format( rtiff )) == VIPS_FORMAT_NOTSET ) + out->BandFmt = guess_format( rtiff ); + if( out->BandFmt == VIPS_FORMAT_NOTSET ) return( -1 ); out->Coding = VIPS_CODING_NONE; @@ -957,15 +961,21 @@ static int parse_copy( ReadTiff *rtiff, VipsImage *out ) { out->Bands = rtiff->samples_per_pixel; - if( (out->BandFmt = guess_format( rtiff )) == VIPS_FORMAT_NOTSET ) + out->BandFmt = guess_format( rtiff ); + if( out->BandFmt == VIPS_FORMAT_NOTSET ) return( -1 ); out->Coding = VIPS_CODING_NONE; if( rtiff->samples_per_pixel >= 3 && (rtiff->photometric_interpretation == PHOTOMETRIC_RGB || rtiff->photometric_interpretation == PHOTOMETRIC_YCBCR) ) { - if( rtiff->bits_per_sample == 16 ) + if( out->BandFmt == VIPS_FORMAT_USHORT ) out->Type = VIPS_INTERPRETATION_RGB16; + else if( !vips_band_format_isint( out->BandFmt ) ) + /* Most float images use 0 - 1 for black - white. + * Photoshop uses 0 - 1 and no gamma. + */ + out->Type = VIPS_INTERPRETATION_scRGB; else out->Type = VIPS_INTERPRETATION_sRGB; }