start adding fallbacks for savers

not finished though
This commit is contained in:
John Cupitt 2019-01-04 07:30:47 +00:00
parent b8a158b69b
commit 7073b8fb17
2 changed files with 12 additions and 12 deletions

View File

@ -126,6 +126,15 @@ vips__fallback_profile_set( const char *name, VipsImage *image )
size_t data_length;
unsigned char *data;
/* Things like jpegsave let you save with no profile by setting
* "none" as a profile name.
*/
if( strcmp( name, "none" ) == 0 ) {
vips_image_remove( image, VIPS_META_ICC_NAME );
return( 0 );
}
/* Already a profile? Do nothing. We could remove and replace non-CMYK
* profiles I guess.
*/

View File

@ -1259,15 +1259,6 @@ vips__foreign_convert_saveable( VipsImage *in, VipsImage **ready,
g_object_unref( in );
in = out;
/* We've imported to PCS, we must remove the embedded profile,
* since it no longer matches the image.
*
* For example, when converting CMYK JPG to RGB PNG, we need
* to remove the CMYK profile on import, or the png writer will
* try to attach it when we write the image as RGB.
*/
vips_image_remove( in, VIPS_META_ICC_NAME );
}
/* If this is something other than CMYK or RAD, eg. maybe a LAB image,
@ -1519,11 +1510,11 @@ vips__foreign_convert_saveable( VipsImage *in, VipsImage **ready,
*/
if( vips_image_get_typeof( in, VIPS_META_ICC_NAME ) ) {
const void *data;
size_t size;
size_t length;
if( !vips_image_get_blob( in, VIPS_META_ICC_NAME,
&data, &size ) &&
!vips_icc_is_compatible_profile( in, data, size ) )
&data, &length ) &&
!vips_icc_is_compatible_profile( in, data, length ) )
vips_image_remove( in, VIPS_META_ICC_NAME );
}