lvandeve / lodepng

PNG encoder and decoder in C and C++.
zlib License
2.06k stars 421 forks source link

Getting incorrect raw data from Photoshop-generated .png files #62

Open DerellLicht opened 6 years ago

DerellLicht commented 6 years ago

I have an application where I need to read .png files as binary data. The png files are in 8-bit rgba format, and I'm having to convert them to a proprietary format for use on a company video display. I read the files using lodepng_decode32_file().

This has been working fine with most png files that I've gotten, but when my co-worker gives me png files which are generated from Adobe Photoshop, the binary data isn't correct; for example, in one file, the first 4 pixels were: before: 00000: 3A F8 55 00 3A F8 55 00 3A F8 55 00 3A F8 55 00 but the data was actually a grey value (i.e., R=G=B). When I re-saved the file using a different program (Faststone Image Viewer), and then read the resulting file, I got: before: 00000: 80 80 80 00 80 80 80 00 80 80 80 00 80 80 80 00

I was originally using a 2013 build of lodepng, but upgraded to current code, unfortunately with same results... Do you have any idea what is wrong here?? Is there some setting that I need to change in order to read the Photoshop png files correctly??