diff --git a/ANNOUNCE b/ANNOUNCE index f191d93c7..3d4466501 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -217,7 +217,8 @@ Version 1.5.4beta04 [June 16, 2011] Added a missing "#ifdef PNG_READ_BACKGROUND_SUPPORTED/#endif" in pngrtran.c Added PNG_TRANSFORM_CHOP_16 to the high-level read transforms. Made PNG_READ_16_TO_8_ACCURATE_SCALE configurable again. If this is - not enabled, png_set_strip_16() and png_do_scale_16_to_8 aren't built. + not enabled, png_set_strip_16() and png_do_scale_16_to_8() aren't built. + Revised contrib/visupng, gregbook, and pngminim to demonstrate chop_16_to_8 Send comments/corrections/commendations to png-mng-implement at lists.sf.net: (subscription required; visit diff --git a/CHANGES b/CHANGES index 88309776e..5771845be 100644 --- a/CHANGES +++ b/CHANGES @@ -3480,7 +3480,8 @@ Version 1.5.4beta04 [June 16, 2011] Added a missing "#ifdef PNG_READ_BACKGROUND_SUPPORTED/#endif" in pngrtran.c Added PNG_TRANSFORM_CHOP_16 to the high-level read transforms. Made PNG_READ_16_TO_8_ACCURATE_SCALE configurable again. If this is - not enabled, png_set_strip_16() and png_do_scale_16_to_8 aren't built. + not enabled, png_set_strip_16() and png_do_scale_16_to_8() aren't built. + Revised contrib/visupng, gregbook, and pngminim to demonstrate chop_16_to_8 Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/contrib/gregbook/readpng.c b/contrib/gregbook/readpng.c index d72309fd1..208a883c5 100644 --- a/contrib/gregbook/readpng.c +++ b/contrib/gregbook/readpng.c @@ -229,8 +229,14 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes) png_set_expand(png_ptr); if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) png_set_expand(png_ptr); +#ifdef PNG_READ_16_TO_8_SUPPORTED if (bit_depth == 16) +# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED + png_set_chop_16(png_ptr); +# else png_set_strip_16(png_ptr); +# endif +#endif if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) png_set_gray_to_rgb(png_ptr); diff --git a/contrib/gregbook/readpng2.c b/contrib/gregbook/readpng2.c index 1772a9065..785772dea 100644 --- a/contrib/gregbook/readpng2.c +++ b/contrib/gregbook/readpng2.c @@ -311,8 +311,14 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr) png_set_expand(png_ptr); if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) png_set_expand(png_ptr); +#ifdef PNG_READ_16_TO_8_SUPPORTED if (bit_depth == 16) +# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED + png_set_chop_16(png_ptr); +# else png_set_strip_16(png_ptr); +# endif +#endif if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) png_set_gray_to_rgb(png_ptr); diff --git a/contrib/pngminim/decoder/pngusr.dfa b/contrib/pngminim/decoder/pngusr.dfa index 9653cd186..d9a1ff2bd 100644 --- a/contrib/pngminim/decoder/pngusr.dfa +++ b/contrib/pngminim/decoder/pngusr.dfa @@ -37,3 +37,4 @@ option SETJMP on option STDIO on option READ_EXPAND on option READ_16_TO_8 on +option READ_16_TO_8_ACCURATE_SCALE on diff --git a/contrib/pngminim/preader/pngusr.dfa b/contrib/pngminim/preader/pngusr.dfa index 5fa9c55bf..155137764 100644 --- a/contrib/pngminim/preader/pngusr.dfa +++ b/contrib/pngminim/preader/pngusr.dfa @@ -37,4 +37,5 @@ option READ_bKGD on option READ_GAMMA on option READ_EXPAND on option READ_16_TO_8 on +option READ_CHOP_16_TO_8 on option READ_GRAY_TO_RGB on diff --git a/contrib/pngminus/png2pnm.c b/contrib/pngminus/png2pnm.c index 9c2c8f848..228142943 100644 --- a/contrib/pngminus/png2pnm.c +++ b/contrib/pngminus/png2pnm.c @@ -144,7 +144,7 @@ int main(int argc, char *argv[]) if (png2pnm (fp_rd, fp_wr, fp_al, raw, alpha) == FALSE) { fprintf (stderr, "PNG2PNM\n"); - fprintf (stderr, "Error: unsuccessful convertion of PNG-image\n"); + fprintf (stderr, "Error: unsuccessful conversion of PNG-image\n"); exit(1); } diff --git a/contrib/visupng/PngFile.c b/contrib/visupng/PngFile.c index e741319e2..5cab576e4 100644 --- a/contrib/visupng/PngFile.c +++ b/contrib/visupng/PngFile.c @@ -175,8 +175,14 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData, // expand images of all color-type and bit-depth to 3x8 bit RGB images // let the library process things like alpha, transparency, background - if (iBitDepth == 16) - png_set_strip_16(png_ptr); +#ifdef PNG_READ_16_TO_8_SUPPORTED + if (iBitDepth == 16) +# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED + png_set_chop_16(png_ptr); +# else + png_set_strip_16(png_ptr); +# endif +#endif if (iColorType == PNG_COLOR_TYPE_PALETTE) png_set_expand(png_ptr); if (iBitDepth < 8)