fix vipsthumbnail with broken embedded profiles
if the embedded profile is broken or incompatible with the specified output profile, retry with the specified input profile see https://github.com/jcupitt/libvips/issues/178
This commit is contained in:
parent
b1f3acf17b
commit
e4461ae1f9
@ -3,6 +3,8 @@
|
||||
- support GRAY as an input and output ICC space
|
||||
- fix a read loop with setjmp() in png read, if the png file is broken
|
||||
- fix vipsthumbnail with both input cmyk and output rgb profiles specified
|
||||
- vipsthumbnail retries with specified input profile if embedded profile is
|
||||
broken
|
||||
|
||||
8/9/14 started 7.40.8
|
||||
- fix configure on rhel6 [Lovell]
|
||||
|
@ -58,6 +58,9 @@
|
||||
* - add an anti-alias filter between shrink and affine
|
||||
* - support CMYK
|
||||
* - use SEQ_UNBUF for a memory saving
|
||||
* 12/9/14
|
||||
* - try with embedded profile first, if that fails retry with fallback
|
||||
* profile
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -567,23 +570,48 @@ thumbnail_shrink( VipsObject *process, VipsImage *in,
|
||||
else if( export_profile &&
|
||||
(vips_image_get_typeof( in, VIPS_META_ICC_NAME ) ||
|
||||
import_profile) ) {
|
||||
if( vips_image_get_typeof( in, VIPS_META_ICC_NAME ) )
|
||||
vips_info( "vipsthumbnail",
|
||||
"importing with embedded profile" );
|
||||
else
|
||||
vips_info( "vipsthumbnail",
|
||||
"importing with profile %s", import_profile );
|
||||
VipsImage *out;
|
||||
|
||||
vips_info( "vipsthumbnail",
|
||||
"exporting with profile %s", export_profile );
|
||||
|
||||
if( vips_icc_transform( in, &t[7], export_profile,
|
||||
"input_profile", import_profile,
|
||||
"embedded", TRUE,
|
||||
NULL ) )
|
||||
return( NULL );
|
||||
/* We first try with the embedded profile, if any, then if
|
||||
* that fails try again with the supplied fallback profile.
|
||||
*/
|
||||
out = NULL;
|
||||
if( vips_image_get_typeof( in, VIPS_META_ICC_NAME ) ) {
|
||||
vips_info( "vipsthumbnail",
|
||||
"importing with embedded profile" );
|
||||
|
||||
in = t[7];
|
||||
if( vips_icc_transform( in, &t[7], export_profile,
|
||||
"embedded", TRUE,
|
||||
NULL ) ) {
|
||||
vips_warn( "vipsthumbnail",
|
||||
_( "unable to import with "
|
||||
"embedded profile: %s" ),
|
||||
vips_error_buffer() );
|
||||
|
||||
vips_error_clear();
|
||||
}
|
||||
else
|
||||
out = t[7];
|
||||
}
|
||||
|
||||
if( !out &&
|
||||
import_profile ) {
|
||||
vips_info( "vipsthumbnail",
|
||||
"importing with fallback profile" );
|
||||
|
||||
if( vips_icc_transform( in, &t[7], export_profile,
|
||||
"input_profile", import_profile,
|
||||
"embedded", FALSE,
|
||||
NULL ) )
|
||||
return( NULL );
|
||||
|
||||
out = t[7];
|
||||
}
|
||||
|
||||
in = out;
|
||||
}
|
||||
|
||||
/* If we are upsampling, don't sharpen, since nearest looks dumb
|
||||
|
Loading…
Reference in New Issue
Block a user