diff --git a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs index 568eea00a..11c6aef29 100644 --- a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs +++ b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs @@ -898,7 +898,7 @@ internal sealed class BmpDecoderCore : IImageDecoderInternals { int colorIndex = ((rowSpan[offset] >> (8 - bitsPerPixel - (shift * bitsPerPixel))) & mask) * bytesPerColorMapEntry; - image[newY, newX].FromBgr24(Unsafe.As(ref colors[colorIndex])); + image[newY, newX] = Bgra32.FromBgr24(Unsafe.As(ref colors[colorIndex])); } offset++; @@ -942,7 +942,7 @@ internal sealed class BmpDecoderCore : IImageDecoderInternals for (int x = 0; x < width; x++) { - pixelRow[x].FromBgra32(image[newY, x]); + pixelRow[x] = TPixel.FromBgra32(image[newY, x]); } } } diff --git a/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs b/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs index fe1c9e0be..f84e4f9c2 100644 --- a/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs +++ b/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs @@ -792,8 +792,7 @@ internal sealed class BmpEncoderCore : IImageEncoderInternals private static void WriteAlphaMask(in TPixel pixel, ref byte mask, in int index) where TPixel : unmanaged, IPixel { - Rgba32 rgba = default; - pixel.ToRgba32(ref rgba); + Rgba32 rgba = pixel.ToRgba32(); if (rgba.A is 0) { mask |= unchecked((byte)(0b10000000 >> index));