Closed GerHobbelt closed 1 year ago
Beautiful detective work! It appears that png is screwing up the right-most column when writing 24 bpp, but bmp is ok. So although the problem may be with pixConvert32To24(), it seems more likely it's in the png writer.
I will investigate.
Dan
Investigated. See: 6c68e008a1b98226d295ee4695f2124b2a968ef5 (incorrectly stated issue #682 instead of issue #686) The error is in png write of 24 bit pix, and I just found it, so will fix it (finally). I was calling pixSetPadBits() on a 24 bit pix, and this was setting some of the components to 0.
See also comment at #675 for code extract as sample code zip.
WARNING: this issue assumes #684 fixed (via #685), or the 24bpp/spp BMPs will be b0rked severely and this won't be reproducible yet.
Here's the BMP output vs. PNG output of same, as shown in Beyond Compare image comparison view:
Relevant code sequence extract shown here (knowing
pixReadWithHint
is same aspixRead
or BMP, but this was coded while looking at #675, wherepixReadWithHint
was initially used) :Sorry, I don't have a fix for this one yet. Just observed and the issue didn't go away when I blinked. 😉