diff --git a/src/ImageSharp/Image.FromBytes.cs b/src/ImageSharp/Image.FromBytes.cs
index 7e55fe787..8365dbd50 100644
--- a/src/ImageSharp/Image.FromBytes.cs
+++ b/src/ImageSharp/Image.FromBytes.cs
@@ -173,6 +173,8 @@ namespace SixLabors.ImageSharp
}
}
+#if !NETSTANDARD1_1
+
///
/// Load a new instance of from the given encoded byte span.
///
@@ -205,10 +207,16 @@ namespace SixLabors.ImageSharp
/// The byte span containing encoded image data.
/// The pixel format.
/// A new .
- public static Image Load(Configuration config, ReadOnlySpan data)
+ public static unsafe Image Load(Configuration config, ReadOnlySpan data)
where TPixel : struct, IPixel
{
- throw new NotImplementedException();
+ fixed (byte* ptr = &data.GetPinnableReference())
+ {
+ using (var stream = new UnmanagedMemoryStream(ptr, data.Length))
+ {
+ return Load(config, stream);
+ }
+ }
}
///
@@ -219,10 +227,19 @@ namespace SixLabors.ImageSharp
/// The decoder.
/// The pixel format.
/// A new .
- public static Image Load(Configuration config, ReadOnlySpan data, IImageDecoder decoder)
+ public static unsafe Image Load(
+ Configuration config,
+ ReadOnlySpan data,
+ IImageDecoder decoder)
where TPixel : struct, IPixel
{
- throw new NotImplementedException();
+ fixed (byte* ptr = &data.GetPinnableReference())
+ {
+ using (var stream = new UnmanagedMemoryStream(ptr, data.Length))
+ {
+ return Load(config, stream, decoder);
+ }
+ }
}
///
@@ -233,10 +250,20 @@ namespace SixLabors.ImageSharp
/// The of the decoded image.
/// The pixel format.
/// A new .
- public static Image Load(Configuration config, ReadOnlySpan data, out IImageFormat format)
+ public static unsafe Image Load(
+ Configuration config,
+ ReadOnlySpan data,
+ out IImageFormat format)
where TPixel : struct, IPixel
{
- throw new NotImplementedException();
+ fixed (byte* ptr = &data.GetPinnableReference())
+ {
+ using (var stream = new UnmanagedMemoryStream(ptr, data.Length))
+ {
+ return Load(config, stream, out format);
+ }
+ }
}
+#endif
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/ImageSharp.csproj b/src/ImageSharp/ImageSharp.csproj
index b1934faa6..9860486e3 100644
--- a/src/ImageSharp/ImageSharp.csproj
+++ b/src/ImageSharp/ImageSharp.csproj
@@ -44,6 +44,9 @@
+
+
+