diff --git a/libvips/foreign/vipspng.c b/libvips/foreign/vipspng.c index 4145131a..0dee03d9 100644 --- a/libvips/foreign/vipspng.c +++ b/libvips/foreign/vipspng.c @@ -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 ) ) )