diff --git a/src/SFML.Graphics/Image.cs b/src/SFML.Graphics/Image.cs
index e167a730..f856ceef 100644
--- a/src/SFML.Graphics/Image.cs
+++ b/src/SFML.Graphics/Image.cs
@@ -297,6 +297,24 @@ public byte[] Pixels
}
}
+ ////////////////////////////////////////////////////////////
+ ///
+ /// Copy the array of pixels (RGBA 8 bits integers
+ /// components) to the provided buffer.
+ /// Buffer size must be at least Width x Height x 4
+ ///
+ /// Buffer to copy to
+ ////////////////////////////////////////////////////////////
+ public void CopyPixels(byte[] buffer)
+ {
+ Vector2u size = Size;
+ if (buffer.Length < size.X * size.Y * 4)
+ {
+ throw new ArgumentException("Buffer must have a size of at least Width * Height * 4 bytes", nameof(buffer));
+ }
+ Marshal.Copy(sfImage_getPixelsPtr(CPointer), buffer, 0, (int)(size.X * size.Y * 4));
+ }
+
////////////////////////////////////////////////////////////
///
/// Size of the image, in pixels