start adding fallbacks for savers
not finished though
This commit is contained in:
parent
b8a158b69b
commit
7073b8fb17
@ -126,6 +126,15 @@ vips__fallback_profile_set( const char *name, VipsImage *image )
|
|||||||
size_t data_length;
|
size_t data_length;
|
||||||
unsigned char *data;
|
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
|
/* Already a profile? Do nothing. We could remove and replace non-CMYK
|
||||||
* profiles I guess.
|
* profiles I guess.
|
||||||
*/
|
*/
|
||||||
|
@ -1259,15 +1259,6 @@ vips__foreign_convert_saveable( VipsImage *in, VipsImage **ready,
|
|||||||
g_object_unref( in );
|
g_object_unref( in );
|
||||||
|
|
||||||
in = out;
|
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,
|
/* 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 ) ) {
|
if( vips_image_get_typeof( in, VIPS_META_ICC_NAME ) ) {
|
||||||
const void *data;
|
const void *data;
|
||||||
size_t size;
|
size_t length;
|
||||||
|
|
||||||
if( !vips_image_get_blob( in, VIPS_META_ICC_NAME,
|
if( !vips_image_get_blob( in, VIPS_META_ICC_NAME,
|
||||||
&data, &size ) &&
|
&data, &length ) &&
|
||||||
!vips_icc_is_compatible_profile( in, data, size ) )
|
!vips_icc_is_compatible_profile( in, data, length ) )
|
||||||
vips_image_remove( in, VIPS_META_ICC_NAME );
|
vips_image_remove( in, VIPS_META_ICC_NAME );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user