diff --git a/tests/Directory.Build.targets b/tests/Directory.Build.targets
index 335f3d106c..ef67b122ed 100644
--- a/tests/Directory.Build.targets
+++ b/tests/Directory.Build.targets
@@ -29,7 +29,7 @@
-
+
diff --git a/tests/ImageSharp.Tests/Formats/Tga/TgaTestUtils.cs b/tests/ImageSharp.Tests/Formats/Tga/TgaTestUtils.cs
index 0f76d99317..58ed31e610 100644
--- a/tests/ImageSharp.Tests/Formats/Tga/TgaTestUtils.cs
+++ b/tests/ImageSharp.Tests/Formats/Tga/TgaTestUtils.cs
@@ -18,7 +18,7 @@ public static void CompareWithReferenceDecoder(
Image image,
bool useExactComparer = true,
float compareTolerance = 0.01f)
- where TPixel : unmanaged, IPixel
+ where TPixel : unmanaged, ImageSharp.PixelFormats.IPixel
{
string path = TestImageProvider.GetFilePathOrNull(provider);
if (path == null)
@@ -39,7 +39,7 @@ public static void CompareWithReferenceDecoder(
}
public static Image DecodeWithMagick(Configuration configuration, FileInfo fileInfo)
- where TPixel : unmanaged, IPixel
+ where TPixel : unmanaged, ImageSharp.PixelFormats.IPixel
{
using (var magickImage = new MagickImage(fileInfo))
{
@@ -48,7 +48,7 @@ public static Image DecodeWithMagick(Configuration configuration
Assert.True(result.TryGetSinglePixelSpan(out Span resultPixels));
- using (IPixelCollection pixels = magickImage.GetPixelsUnsafe())
+ using (IUnsafePixelCollection pixels = magickImage.GetPixelsUnsafe())
{
byte[] data = pixels.ToByteArray(PixelMapping.RGBA);
diff --git a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/MagickReferenceDecoder.cs b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/MagickReferenceDecoder.cs
index de8278a33e..8efc9a0235 100644
--- a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/MagickReferenceDecoder.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/MagickReferenceDecoder.cs
@@ -7,6 +7,7 @@
using System.Threading;
using System.Threading.Tasks;
using ImageMagick;
+using ImageMagick.Formats.Bmp;
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
@@ -18,7 +19,7 @@ public class MagickReferenceDecoder : IImageDecoder
public static MagickReferenceDecoder Instance { get; } = new MagickReferenceDecoder();
private static void FromRgba32Bytes(Configuration configuration, Span rgbaBytes, IMemoryGroup destinationGroup)
- where TPixel : unmanaged, IPixel
+ where TPixel : unmanaged, ImageSharp.PixelFormats.IPixel
{
foreach (Memory m in destinationGroup)
{
@@ -33,7 +34,7 @@ private static void FromRgba32Bytes(Configuration configuration, Span(Configuration configuration, Span rgbaBytes, IMemoryGroup destinationGroup)
- where TPixel : unmanaged, IPixel
+ where TPixel : unmanaged, ImageSharp.PixelFormats.IPixel
{
foreach (Memory m in destinationGroup)
{
@@ -48,17 +49,28 @@ private static void FromRgba64Bytes(Configuration configuration, Span> DecodeAsync(Configuration configuration, Stream stream, CancellationToken cancellationToken)
- where TPixel : unmanaged, IPixel
+ where TPixel : unmanaged, ImageSharp.PixelFormats.IPixel
=> Task.FromResult(this.Decode(configuration, stream));
public Image Decode(Configuration configuration, Stream stream)
- where TPixel : unmanaged, IPixel
+ where TPixel : unmanaged, ImageSharp.PixelFormats.IPixel
{
- using var magickImage = new MagickImage(stream);
+ var bmpReadDefines = new BmpReadDefines
+ {
+ // See https://github.com/SixLabors/ImageSharp/issues/1380
+ // Validation fails on Ubuntu despite identical header generation
+ // on all platforms.
+ IgnoreFileSize = !TestEnvironment.IsWindows
+ };
+
+ var settings = new MagickReadSettings();
+ settings.SetDefines(bmpReadDefines);
+
+ using var magickImage = new MagickImage(stream, settings);
var result = new Image(configuration, magickImage.Width, magickImage.Height);
MemoryGroup resultPixels = result.GetRootFramePixelBuffer().FastMemoryGroup;
- using (IPixelCollection pixels = magickImage.GetPixelsUnsafe())
+ using (IUnsafePixelCollection pixels = magickImage.GetPixelsUnsafe())
{
if (magickImage.Depth == 8)
{