Prevent libpng verifying sRGB profiles

Ensures PNG images saved by Photoshop work

Mirrors the behaviour of Imagemagick
This commit is contained in:
Lovell Fuller 2014-08-07 08:18:49 +01:00
parent ecd771cde7
commit df2b7c5430
1 changed files with 12 additions and 0 deletions

View File

@ -188,6 +188,12 @@ read_new( VipsImage *out, gboolean readbehind )
user_error_function, user_warning_function )) )
return( NULL );
#ifdef PNG_SKIP_sRGB_CHECK_PROFILE
/* Prevent libpng (>=1.6.11) verifying sRGB profiles.
*/
png_set_option( read->pPng, PNG_SKIP_sRGB_CHECK_PROFILE, PNG_OPTION_ON );
#endif /*PNG_SKIP_sRGB_CHECK_PROFILE*/
/* Catch PNG errors from png_create_info_struct().
*/
if( setjmp( png_jmpbuf( read->pPng ) ) )
@ -717,6 +723,12 @@ write_new( VipsImage *in )
user_error_function, user_warning_function )) )
return( NULL );
#ifdef PNG_SKIP_sRGB_CHECK_PROFILE
/* Prevent libpng (>=1.6.11) verifying sRGB profiles.
*/
png_set_option( write->pPng, PNG_SKIP_sRGB_CHECK_PROFILE, PNG_OPTION_ON );
#endif /*PNG_SKIP_sRGB_CHECK_PROFILE*/
/* Catch PNG errors from png_create_info_struct().
*/
if( setjmp( png_jmpbuf( write->pPng ) ) )