diff --git a/ANNOUNCE b/ANNOUNCE index 065a28c0d..57e95d947 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -41,6 +41,9 @@ Version 1.6.2beta01 [April 14, 2013] Version 1.6.2beta02 [April 17, 2013] Added contrib/tools/fixitxt.c, to repair the erroneous iTXt chunk length written by libpng-1.6.0 and 1.6.1. + Levchenko). + Added #ifdef PNG_WRITE_sRGB_SUPPORTED, etc., tests where needed in + png_image_write_main() in pngwrite.c (bug report from Yuriy Levchenko). Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index c3484516b..65c03bd0b 100644 --- a/CHANGES +++ b/CHANGES @@ -4489,6 +4489,8 @@ Version 1.6.2beta01 [April 14, 2013] Version 1.6.2beta02 [April 17, 2013] Added contrib/tools/fixitxt.c, to repair the erroneous iTXt chunk length written by libpng-1.6.0 and 1.6.1. + Added #ifdef PNG_WRITE_sRGB_SUPPORTED, etc., tests where needed in + png_image_write_main() in pngwrite.c (bug report from Yuriy Levchenko). Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngwrite.c b/pngwrite.c index b0887bd75..196e8c0f7 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -2074,9 +2074,12 @@ png_image_write_main(png_voidp argument) if (write_16bit) { +#ifdef PNG_WRITE_gAMA_SUPPORTED /* The gamma here is 1.0 (linear) and the cHRM chunk matches sRGB. */ png_set_gAMA_fixed(png_ptr, info_ptr, PNG_GAMMA_LINEAR); +#endif +#ifdef PNG_WRITE_cHRM_SUPPORTED if (!(image->flags & PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB)) png_set_cHRM_fixed(png_ptr, info_ptr, /* color x y */ @@ -2086,15 +2089,20 @@ png_image_write_main(png_voidp argument) /* blue */ 15000, 6000 ); } +#endif +#ifdef PNG_WRITE_sRGB_SUPPORTED else if (!(image->flags & PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB)) png_set_sRGB(png_ptr, info_ptr, PNG_sRGB_INTENT_PERCEPTUAL); +#endif +#ifdef PNG_WRITE_gAMA_SUPPORTED /* Else writing an 8-bit file and the *colors* aren't sRGB, but the 8-bit * space must still be gamma encoded. */ else png_set_gAMA_fixed(png_ptr, info_ptr, PNG_GAMMA_sRGB_INVERSE); +#endif /* Write the file header. */ png_write_info(png_ptr, info_ptr);