fix profile handling in XYZ2scRGB

see

https://github.com/lovell/sharp/issues/125
This commit is contained in:
John Cupitt 2014-11-25 12:01:13 +00:00
parent 8a44d6f7b3
commit f66afb78da
2 changed files with 16 additions and 12 deletions

View File

@ -1,6 +1,7 @@
27/10/14 started 7.40.12
- better tiff detection (Lovell)
- fix memleak in sharpen (Lovell)
- fix profile handling in XYZ2scRGB, thanks Lovell
8/10/14 started 7.40.11
- rework extra band handling for colour functions

View File

@ -4,6 +4,8 @@
* - from Yxy2XYZ.c
* 1/7/13
* - remove any ICC profile
* 25/11/14
* - oh argh, revert the above
*/
/*
@ -50,20 +52,21 @@ typedef VipsColourSpaceClass VipsXYZ2scRGBClass;
G_DEFINE_TYPE( VipsXYZ2scRGB, vips_XYZ2scRGB, VIPS_TYPE_COLOUR_SPACE );
static int
vips_XYZ2scRGB_build( VipsObject *object )
{
if( VIPS_OBJECT_CLASS( vips_XYZ2scRGB_parent_class )->build( object ) )
return( -1 );
/* We used to have the comment:
/* We've converted to sRGB without a profile. We must remove any ICC
* We've converted to sRGB without a profile. We must remove any ICC
* profile left over from import or there will be a mismatch between
* pixel values and the attached profile.
*/
vips_image_remove( VIPS_COLOUR( object )->out, VIPS_META_ICC_NAME );
return( 0 );
}
But this isn't right, we often call things sRGB that we know are not true
sRGB, for example:
vips sharpen k2.jpg x.jpg
sharpen will treat k2 as being in sRGB space even if that image has a
profile. If we drop the profile, x.jpg is suddenly untagged.
*/
void
vips_XYZ2scRGB_line( VipsColour *colour, VipsPel *out, VipsPel **in, int width )
@ -100,7 +103,6 @@ vips_XYZ2scRGB_class_init( VipsXYZ2scRGBClass *class )
object_class->nickname = "XYZ2scRGB";
object_class->description = _( "transform XYZ to scRGB" );
object_class->build = vips_XYZ2scRGB_build;
colour_class->process_line = vips_XYZ2scRGB_line;
}
@ -117,8 +119,9 @@ vips_XYZ2scRGB_init( VipsXYZ2scRGB *XYZ2scRGB )
* vips_XYZ2scRGB:
* @in: input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Turn XYZ to Yxy.
* Turn XYZ to scRGB.
*
* Returns: 0 on success, -1 on error
*/