Skip to content

Commit b29cd27

Browse files
committed
Fixed bug in Write1BitPixelData that wrote too many bits to the byte
1 parent b4ad3c3 commit b29cd27

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ private void Write1BitPixelData<TPixel>(Configuration configuration, Stream stre
668668

669669
if (quantizedPixelRow.Length % 8 != 0)
670670
{
671-
int startIdx = quantizedPixelRow.Length - 7;
671+
int startIdx = quantizedPixelRow.Length - (quantizedPixelRow.Length % 8);
672672
endIdx = quantizedPixelRow.Length;
673673
Write1BitPalette(stream, startIdx, endIdx, quantizedPixelRow);
674674
}

0 commit comments

Comments
 (0)