lvandeve / lodepng

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

can not work correctly when convert bmp 32bit to png #42

Open kevin-gjm opened 7 years ago

kevin-gjm commented 7 years ago

in file lodepng/examples/example_bmp2png.cpp. Line 93-97 wrong R/G/B/A order

should be : image[newpos + 0] = bmp[bmpos + 2]; image[newpos + 1] = bmp[bmpos + 1]; image[newpos + 2] = bmp[bmpos + 0]; image[newpos + 3] = bmp[bmpos + 3]; when I use this it can work well.

BOT-Man-JL commented 7 years ago

@kevin-gjm Your post helps a lot ~ 👍 Thanks very much~

But there is another problem:

In this article, after calling GetDIBits, I found that bmp[bmpos + 3] is always 0, which means the pixel is transparent;

So is it an issue?

kevin-gjm commented 7 years ago

@BOT-Man-JL
Yes, I test it in other machines.Some work well but some can not. So I made it all 255 as a temporary solution. But it lost the transparency information. image[newpos + 3] = 255;