Browse Source

Merge pull request #2911 from zabulus/fix_2907

Fix #2907. BMP indexed palette parsed wrong
pull/2916/head
James Jackson-South 1 year ago
committed by GitHub
parent
commit
daa10b5dd5
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  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