Browse Source

Fix #2907. Wrong rgb used for color table

pull/2911/head
zabulus 1 year ago
parent
commit
940076087a
  1. 4
      src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs

4
src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs

@ -1597,8 +1597,8 @@ internal sealed class BmpDecoderCore : ImageDecoderCore
if (palette.Length > 0)
{
Color[] colorTable = new Color[palette.Length / Unsafe.SizeOf<Bgr24>()];
ReadOnlySpan<Bgr24> rgbTable = MemoryMarshal.Cast<byte, Bgr24>(palette);
Color[] colorTable = new Color[palette.Length / Unsafe.SizeOf<Bgra32>()];
ReadOnlySpan<Bgra32> rgbTable = MemoryMarshal.Cast<byte, Bgra32>(palette);
Color.FromPixel(rgbTable, colorTable);
this.bmpMetadata.ColorTable = colorTable;
}

Loading…
Cancel
Save