BitmapByteQRCode.GetGraphic uses the following formula to calculate the number of padding bytes per row:
var paddingLen = sideLength % 4;
That's not correct. It happens to work when sideLength is even, i.e. when pixelsPerModule is even, but it fails when sideLength is odd.
The correct formula would be (4 - (sideLength % 4)) % 4, or the more efficient equivalent -sideLength & 3.
BitmapByteQRCode.GetGraphicuses the following formula to calculate the number of padding bytes per row:That's not correct. It happens to work when
sideLengthis even, i.e. whenpixelsPerModuleis even, but it fails whensideLengthis odd.The correct formula would be
(4 - (sideLength % 4)) % 4, or the more efficient equivalent-sideLength & 3.