diff --git a/src/ImageSharp/Image.LoadPixelData.cs b/src/ImageSharp/Image.LoadPixelData.cs
index 5f85d61ba..307660b5a 100644
--- a/src/ImageSharp/Image.LoadPixelData.cs
+++ b/src/ImageSharp/Image.LoadPixelData.cs
@@ -33,7 +33,7 @@ namespace SixLabors.ImageSharp
/// The height of the final image.
/// The pixel format.
/// A new .
- public static Image LoadPixelData(Span data, int width, int height)
+ public static Image LoadPixelData(ReadOnlySpan data, int width, int height)
where TPixel : struct, IPixel
=> LoadPixelData(Configuration.Default, data, width, height);
@@ -72,7 +72,7 @@ namespace SixLabors.ImageSharp
/// A new .
public static Image LoadPixelData(Configuration config, byte[] data, int width, int height)
where TPixel : struct, IPixel
- => LoadPixelData(config, MemoryMarshal.Cast(data.AsSpan()), width, height);
+ => LoadPixelData(config, MemoryMarshal.Cast(new ReadOnlySpan(data)), width, height);
///
/// Create a new instance of the class from the given byte array in format.
@@ -83,7 +83,7 @@ namespace SixLabors.ImageSharp
/// The height of the final image.
/// The pixel format.
/// A new .
- public static Image LoadPixelData(Configuration config, Span data, int width, int height)
+ public static Image LoadPixelData(Configuration config, ReadOnlySpan data, int width, int height)
where TPixel : struct, IPixel
=> LoadPixelData(config, MemoryMarshal.Cast(data), width, height);
@@ -99,7 +99,7 @@ namespace SixLabors.ImageSharp
public static Image LoadPixelData(Configuration config, TPixel[] data, int width, int height)
where TPixel : struct, IPixel
{
- return LoadPixelData(config, data.AsSpan(), width, height);
+ return LoadPixelData(config, new ReadOnlySpan(data), width, height);
}
///
@@ -111,7 +111,7 @@ namespace SixLabors.ImageSharp
/// The height of the final image.
/// The pixel format.
/// A new .
- public static Image LoadPixelData(Configuration config, Span data, int width, int height)
+ public static Image LoadPixelData(Configuration config, ReadOnlySpan data, int width, int height)
where TPixel : struct, IPixel
{
int count = width * height;