diff --git a/src/ImageSharp/PixelFormats/PackedPixelConverterHelper.cs b/src/ImageSharp/PixelFormats/PackedPixelConverterHelper.cs index 0537ff514..ae5f785a9 100644 --- a/src/ImageSharp/PixelFormats/PackedPixelConverterHelper.cs +++ b/src/ImageSharp/PixelFormats/PackedPixelConverterHelper.cs @@ -290,9 +290,11 @@ namespace SixLabors.ImageSharp.PixelFormats /// The private static bool IsStandardNormalizedType(Type type) { - return type == typeof(Rgba32) + return + type == typeof(Alpha8) || type == typeof(Argb32) - || type == typeof(Alpha8) + || type == typeof(Bgr24) + || type == typeof(Bgra32) || type == typeof(Bgr565) || type == typeof(Bgra4444) || type == typeof(Bgra5551) @@ -300,8 +302,10 @@ namespace SixLabors.ImageSharp.PixelFormats || type == typeof(HalfVector2) || type == typeof(HalfVector4) || type == typeof(Rg32) - || type == typeof(Rgba1010102) - || type == typeof(Rgba64); + || type == typeof(Rgb24) + || type == typeof(Rgba32) + || type == typeof(Rgba64) + || type == typeof(Rgba1010102); } /// diff --git a/tests/ImageSharp.Tests/Image/ImageCloneTests.cs b/tests/ImageSharp.Tests/Image/ImageCloneTests.cs new file mode 100644 index 000000000..12e0fc883 --- /dev/null +++ b/tests/ImageSharp.Tests/Image/ImageCloneTests.cs @@ -0,0 +1,36 @@ +using System; +using SixLabors.ImageSharp.Advanced; +using SixLabors.ImageSharp.PixelFormats; +using Xunit; + +namespace SixLabors.ImageSharp.Tests +{ + public class ImageCloneTests + { + [Theory] + [WithTestPatternImages(9, 9, PixelTypes.Rgba32)] + public void CloneAs_ToBgra32(TestImageProvider provider) + { + using (Image image = provider.GetImage()) + using (Image clone = image.CloneAs()) + { + for (int y = 0; y < image.Height; y++) + { + Span row = image.GetPixelRowSpan(y); + Span rowClone = clone.GetPixelRowSpan(y); + + for (int x = 0; x < image.Width; x++) + { + Rgba32 rgba = row[x]; + Bgra32 bgra = rowClone[x]; + + Assert.Equal(rgba.R, bgra.R); + Assert.Equal(rgba.G, bgra.G); + Assert.Equal(rgba.B, bgra.B); + Assert.Equal(rgba.A, bgra.A); + } + } + } + } + } +} \ No newline at end of file