Applied fix for [ 439207 ] Monochrome PNG images come up black
Joel Tesler (jtesler) A monochrome black and white PNG image comes up all black. This is referring to a single bit greyscale pixmap, not a one bit palette pxiamp. The easiest way to reproduce is to grab http://www.schaik.com/pngsuite/basn0g01.png and go into the image sample, and replace horse.png with this file. The following patch appears to fix the problem. However, I do not know what other side effects it might have. --- imagpng.cpp~ Fri Jul 6 14:53:33 2001 +++ imagpng.cpp Fri Jul 6 15:17:06 2001 @@ -140,6 +140,8 @@ if (color_type == PNG_COLOR_TYPE_PALETTE) png_set_expand( png_ptr ); + if (bit_depth < 8) + png_set_expand( png_ptr ); png_set_strip_16( png_ptr ); png_set_packing( png_ptr ); git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17295 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -188,6 +188,10 @@ bool wxPNGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
|
||||
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
png_set_expand( png_ptr );
|
||||
|
||||
// Fix for Bug [ 439207 ] Monochrome PNG images come up black
|
||||
if (bit_depth < 8)
|
||||
png_set_expand( png_ptr );
|
||||
|
||||
png_set_strip_16( png_ptr );
|
||||
png_set_packing( png_ptr );
|
||||
if (png_get_valid( png_ptr, info_ptr, PNG_INFO_tRNS))
|
||||
|
||||
Reference in New Issue
Block a user