soywiz-archive/korim

BMP Decoding

bedalton opened this issue · 0 comments

There is a problem with BMP decoding. The padding is calculated as 4 - (bytesPerRow % 4). Which means when the width is exactly divisible by 4, you have a padding of 4. This messes up the image considerably.

The check should probably be:if (padding != 4) { instead of if (padding != 0){

https://github.com/korlibs/korim/blob/d05eff45d0cb156336cf8dd9557731a3ec9243cb/korim/src/commonMain/kotlin/com/soywiz/korim/format/BMP.kt#L59

https://github.com/korlibs/korim/blob/d05eff45d0cb156336cf8dd9557731a3ec9243cb/korim/src/commonMain/kotlin/com/soywiz/korim/format/BMP.kt#L65