lvandeve/lodepng

RGB to PNG wrong alignment?

avafinger opened this issue · 3 comments

Hi @lvandeve , thanks for your work.
I am trying to convert the data portion of a windows bitmap to png but it fails when (h % 4 ) > 0.
There seems some alignment issue, I could not figure out.

The environment and compiler are Windows and Visual C, 32 bit.
Perhaps I should force some alignment during compilation, can you suggest a possible fix or where I should look for in order to fix this?

Attached are the results of a successful conversion (264x264) and a failed one (198x198).

FYI, the bmp header info is not filled up completely, you must assume the size, but there is something wrong with the padding.

Tested on Linux x64, same problem.
So, lodepng_encode24_file(szbuf, data, bmInfoHeader->biWidth, bmInfoHeader->biHeight); does not consider padding.

passing data without the padding worked.