diff --git a/ChangeLog b/ChangeLog index 8d28f89c..d380a87a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,10 +12,12 @@ - python vips8 binding - python vips8 test suite: test_arithmetic.py, test_colour.py, test_conversion.py -- better extra band handling by colour, again - move zoomify ImageProperties file, now a better match to the offical tool - rename VIPS_ANGLE_180 as VIPS_ANGLE_D180 etc. to help python +8/10/14 started 7.40.11 +- rework extra band handling for colour functions + 8/9/14 started 7.40.10 - icc_import and icc_transform checks the input profile for compatibility with the image, thanks James diff --git a/libvips/colour/Lab2LabQ.c b/libvips/colour/Lab2LabQ.c index bd982508..a7563645 100644 --- a/libvips/colour/Lab2LabQ.c +++ b/libvips/colour/Lab2LabQ.c @@ -149,11 +149,11 @@ vips_Lab2LabQ_init( VipsLab2LabQ *Lab2LabQ ) colour->coding = VIPS_CODING_LABQ; colour->interpretation = VIPS_INTERPRETATION_LABQ; colour->format = VIPS_FORMAT_UCHAR; + colour->input_bands = 3; colour->bands = 4; code->input_coding = VIPS_CODING_NONE; code->input_format = VIPS_FORMAT_FLOAT; - colour->input_bands = 3; } /** diff --git a/libvips/colour/Lab2LabS.c b/libvips/colour/Lab2LabS.c index c7c3a79f..95713c85 100644 --- a/libvips/colour/Lab2LabS.c +++ b/libvips/colour/Lab2LabS.c @@ -90,11 +90,11 @@ vips_Lab2LabS_init( VipsLab2LabS *Lab2LabS ) colour->interpretation = VIPS_INTERPRETATION_LABS; colour->format = VIPS_FORMAT_SHORT; + colour->input_bands = 3; colour->bands = 3; code->input_coding = VIPS_CODING_NONE; code->input_format = VIPS_FORMAT_FLOAT; - colour->input_bands = 3; } /** diff --git a/libvips/colour/LabS2Lab.c b/libvips/colour/LabS2Lab.c index 32de7be4..f83c76b0 100644 --- a/libvips/colour/LabS2Lab.c +++ b/libvips/colour/LabS2Lab.c @@ -88,11 +88,11 @@ vips_LabS2Lab_init( VipsLabS2Lab *LabS2Lab ) colour->interpretation = VIPS_INTERPRETATION_LAB; colour->format = VIPS_FORMAT_FLOAT; + colour->input_bands = 3; colour->bands = 3; code->input_coding = VIPS_CODING_NONE; code->input_format = VIPS_FORMAT_SHORT; - colour->input_bands = 3; } /** diff --git a/libvips/colour/LabS2LabQ.c b/libvips/colour/LabS2LabQ.c index 06601e3e..5f896a88 100644 --- a/libvips/colour/LabS2LabQ.c +++ b/libvips/colour/LabS2LabQ.c @@ -137,11 +137,11 @@ vips_LabS2LabQ_init( VipsLabS2LabQ *LabS2LabQ ) colour->coding = VIPS_CODING_LABQ; colour->interpretation = VIPS_INTERPRETATION_LABQ; colour->format = VIPS_FORMAT_UCHAR; + colour->input_bands = 3; colour->bands = 4; code->input_coding = VIPS_CODING_NONE; code->input_format = VIPS_FORMAT_SHORT; - colour->input_bands = 3; } /** diff --git a/libvips/colour/float2rad.c b/libvips/colour/float2rad.c index a133b799..fecaa669 100644 --- a/libvips/colour/float2rad.c +++ b/libvips/colour/float2rad.c @@ -212,11 +212,11 @@ vips_float2rad_init( VipsFloat2rad *float2rad ) colour->coding = VIPS_CODING_RAD; colour->interpretation = VIPS_INTERPRETATION_scRGB; colour->format = VIPS_FORMAT_UCHAR; + colour->input_bands = 3; colour->bands = 4; code->input_coding = VIPS_CODING_NONE; code->input_format = VIPS_FORMAT_FLOAT; - colour->input_bands = 3; } /** diff --git a/libvips/colour/icc_transform.c b/libvips/colour/icc_transform.c index c11a6a27..0c59157d 100644 --- a/libvips/colour/icc_transform.c +++ b/libvips/colour/icc_transform.c @@ -506,7 +506,9 @@ vips_icc_load_profile_image( const char *domain, VipsImage *image ) return( NULL ); } - if( image->Bands != vips_icc_profile_needs_bands( profile ) ) { + /* We allow extra bands for eg. alpha. + */ + if( image->Bands < vips_icc_profile_needs_bands( profile ) ) { VIPS_FREEF( cmsCloseProfile, profile ); vips_warn( domain, "%s", _( "embedded profile incompatible with image" ) ); @@ -528,7 +530,9 @@ vips_icc_load_profile_file( const char *domain, return( NULL ); } - if( image->Bands != vips_icc_profile_needs_bands( profile ) ) { + /* We allow extra bands for eg. alpha. + */ + if( image->Bands < vips_icc_profile_needs_bands( profile ) ) { VIPS_FREEF( cmsCloseProfile, profile ); vips_warn( domain, _( "profile \"%s\" incompatible with image" ), diff --git a/libvips/colour/sRGB2scRGB.c b/libvips/colour/sRGB2scRGB.c index 1102365e..c8b21aad 100644 --- a/libvips/colour/sRGB2scRGB.c +++ b/libvips/colour/sRGB2scRGB.c @@ -163,10 +163,10 @@ vips_sRGB2scRGB_init( VipssRGB2scRGB *sRGB2scRGB ) colour->coding = VIPS_CODING_NONE; colour->interpretation = VIPS_INTERPRETATION_scRGB; colour->format = VIPS_FORMAT_FLOAT; + colour->input_bands = 3; colour->bands = 3; code->input_coding = VIPS_CODING_NONE; - colour->input_bands = 3; /* The default. This can get changed above ^^ if we see a * 16-bit input. diff --git a/libvips/colour/scRGB2sRGB.c b/libvips/colour/scRGB2sRGB.c index 685f4c34..ef00c959 100644 --- a/libvips/colour/scRGB2sRGB.c +++ b/libvips/colour/scRGB2sRGB.c @@ -208,10 +208,10 @@ vips_scRGB2sRGB_init( VipsscRGB2sRGB *scRGB2sRGB ) colour->coding = VIPS_CODING_NONE; colour->interpretation = VIPS_INTERPRETATION_sRGB; colour->format = VIPS_FORMAT_UCHAR; + colour->input_bands = 3; colour->bands = 3; code->input_coding = VIPS_CODING_NONE; - colour->input_bands = 3; code->input_format = VIPS_FORMAT_FLOAT; scRGB2sRGB->depth = 8;