simpler profile handling for thumbnail
use the fallback handling logic in vips_icc_*() instead of having our own
This commit is contained in:
parent
6f2861df5b
commit
da7b62680d
@ -368,10 +368,9 @@ vips_thumbnail_build( VipsObject *object )
|
|||||||
in->BandFmt == VIPS_FORMAT_USHORT) &&
|
in->BandFmt == VIPS_FORMAT_USHORT) &&
|
||||||
(vips_image_get_typeof( in, VIPS_META_ICC_NAME ) ||
|
(vips_image_get_typeof( in, VIPS_META_ICC_NAME ) ||
|
||||||
thumbnail->import_profile) ) {
|
thumbnail->import_profile) ) {
|
||||||
if( vips_image_get_typeof( in, VIPS_META_ICC_NAME ) )
|
g_info( "importing to XYZ PCS" );
|
||||||
g_info( "importing with embedded profile" );
|
if( thumbnail->import_profile )
|
||||||
else
|
g_info( "fallback input profile %s",
|
||||||
g_info( "importing with profile %s",
|
|
||||||
thumbnail->import_profile );
|
thumbnail->import_profile );
|
||||||
|
|
||||||
if( vips_icc_import( in, &t[1],
|
if( vips_icc_import( in, &t[1],
|
||||||
@ -458,52 +457,19 @@ vips_thumbnail_build( VipsObject *object )
|
|||||||
else if( thumbnail->export_profile &&
|
else if( thumbnail->export_profile &&
|
||||||
(vips_image_get_typeof( in, VIPS_META_ICC_NAME ) ||
|
(vips_image_get_typeof( in, VIPS_META_ICC_NAME ) ||
|
||||||
thumbnail->import_profile) ) {
|
thumbnail->import_profile) ) {
|
||||||
VipsImage *out;
|
g_info( "transforming to %s", thumbnail->export_profile );
|
||||||
|
if( thumbnail->import_profile )
|
||||||
|
g_info( "fallback input profile %s",
|
||||||
|
thumbnail->import_profile );
|
||||||
|
|
||||||
g_info( "exporting with profile %s", thumbnail->export_profile );
|
if( vips_icc_transform( in, &t[7],
|
||||||
|
thumbnail->export_profile,
|
||||||
/* We first try with the embedded profile, if any, then if
|
"input_profile", thumbnail->import_profile,
|
||||||
* that fails try again with the supplied fallback profile.
|
"intent", thumbnail->intent,
|
||||||
*/
|
"embedded", TRUE,
|
||||||
out = NULL;
|
NULL ) )
|
||||||
if( vips_image_get_typeof( in, VIPS_META_ICC_NAME ) ) {
|
return( -1 );
|
||||||
g_info( "importing with embedded profile" );
|
in = t[7];
|
||||||
|
|
||||||
if( vips_icc_transform( in, &t[7],
|
|
||||||
thumbnail->export_profile,
|
|
||||||
"intent", thumbnail->intent,
|
|
||||||
"embedded", TRUE,
|
|
||||||
NULL ) ) {
|
|
||||||
g_warning( _( "unable to import with "
|
|
||||||
"embedded profile: %s" ),
|
|
||||||
vips_error_buffer() );
|
|
||||||
|
|
||||||
vips_error_clear();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
out = t[7];
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !out &&
|
|
||||||
thumbnail->import_profile ) {
|
|
||||||
g_info( "importing with fallback profile" );
|
|
||||||
|
|
||||||
if( vips_icc_transform( in, &t[7],
|
|
||||||
thumbnail->export_profile,
|
|
||||||
"input_profile", thumbnail->import_profile,
|
|
||||||
"intent", thumbnail->intent,
|
|
||||||
"embedded", FALSE,
|
|
||||||
NULL ) )
|
|
||||||
return( -1 );
|
|
||||||
|
|
||||||
out = t[7];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If the embedded profile failed and there's no fallback or
|
|
||||||
* the fallback failed, out will still be NULL.
|
|
||||||
*/
|
|
||||||
if( out )
|
|
||||||
in = out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( thumbnail->auto_rotate &&
|
if( thumbnail->auto_rotate &&
|
||||||
|
Loading…
Reference in New Issue
Block a user