Fixed wrong image format when loading 32bit bitmaps

This commit is contained in:
Darth Affe 2024-07-14 22:53:18 +02:00
parent 0a731b5ca4
commit 8fd2ee7091

View File

@ -75,7 +75,7 @@ public static class ImageExtension
if (data.PixelFormat.HasFlag(PixelFormat.Format24bppRgb)) if (data.PixelFormat.HasFlag(PixelFormat.Format24bppRgb))
image = Image<ColorRGB>.Create(buffer, data.Width, data.Height, data.Stride); image = Image<ColorRGB>.Create(buffer, data.Width, data.Height, data.Stride);
else if (data.PixelFormat.HasFlag(PixelFormat.Format32bppArgb)) else if (data.PixelFormat.HasFlag(PixelFormat.Format32bppArgb))
image = Image<ColorARGB>.Create(buffer, data.Width, data.Height, data.Stride); image = Image<ColorRGBA>.Create(buffer, data.Width, data.Height, data.Stride);
else throw new NotSupportedException($"Unsupported pixel format '{bitmap.PixelFormat}'."); else throw new NotSupportedException($"Unsupported pixel format '{bitmap.PixelFormat}'.");
bitmap.UnlockBits(data); bitmap.UnlockBits(data);