When passing the PNG_TRANSFORM_STRIP_FILLER_AFTER flag to png_write_png(), libpng 1.5.2 incorrectly strips the first byte of each pixel rather than the last one. For example, given the byte sequence 0x12 0x34 0x56 0x78 for a pixel in RGBA byte order, libpng 1.5.2 incorrectly writes a pixel with R=0x34 G=0x56 B=0x78, while libpng 1.5.1 acts correctly (storing R=0x12 G=0x34 B=0x56 in this example).
It looks as though some of the PNG flags were mixed up.
The new calls to png_do_strip_channel look like this:
png_do_strip_channel(&(png_ptr->row_info), png_ptr->row_buf + 1,
!(png_ptr->flags & PNG_FILLER_AFTER));
Shouldn't that be PNG_FLAG_FILLER_AFTER ? PNG_FILLER_AFTER
is 0x1, but the 0x1 bit in png_ptr->flags is the flag for ZLIB_CUSTOM_STRATEGY.
Andrew, please try libpng-1.5.3beta04.
I assume you meant 1.5.3beta03? I've just tried it and can confirm that it fixes this problem. Thanks!
Yes, beta03. Thanks for the report.
fixed in libpng-1.5.3beta03. Thanks.
Fixed in libpng-1.5.4.