You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug in BMP padding calculation when pixelsPerModule is odd #697
Hmmm, it looks like the code may have been correct after all, albeit in a non-obvious way.
Indeed, sideLength is the number of pixels, not the number of bytes in a pixel row. That needs to be multiplied by 3 to obtain the number of bytes. That multiplication by 3 saves the day.
Activity
KrisVandermotten commentedon Jul 12, 2026
Hmmm, it looks like the code may have been correct after all, albeit in a non-obvious way.
Indeed,
sideLengthis the number of pixels, not the number of bytes in a pixel row. That needs to be multiplied by 3 to obtain the number of bytes. That multiplication by 3 saves the day.sideLength % 4(sideLength % 4) * 3((sideLength % 4) * 3) % 4Sorry about that.
Shane32 commentedon Jul 24, 2026
No problem and thanks for looking into it!