Browse Source

Fixed bug in Write1BitPixelData that wrote too many bits to the byte

pull/2471/head
Gerard Gunnewijk 3 years ago
parent
commit
b29cd27c10
  1. 2
      src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs

2
src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs

@ -668,7 +668,7 @@ internal sealed class BmpEncoderCore : IImageEncoderInternals
if (quantizedPixelRow.Length % 8 != 0) if (quantizedPixelRow.Length % 8 != 0)
{ {
int startIdx = quantizedPixelRow.Length - 7; int startIdx = quantizedPixelRow.Length - (quantizedPixelRow.Length % 8);
endIdx = quantizedPixelRow.Length; endIdx = quantizedPixelRow.Length;
Write1BitPalette(stream, startIdx, endIdx, quantizedPixelRow); Write1BitPalette(stream, startIdx, endIdx, quantizedPixelRow);
} }

Loading…
Cancel
Save