ARCed.XnaExtensions.ToImage C# (CSharp) Method

ToImage() public static method

Converts a Texture2D to an System.Drawing.Image and returns it.
public static ToImage ( this texture ) : Image
texture this Texture to convert
return Image
        public static Image ToImage(this Texture2D texture)
        {
            Image image = null;
            using (var stream = new MemoryStream())
            {
                texture.SaveAsPng(stream, texture.Width, texture.Height);
                stream.Seek(0, SeekOrigin.Begin);
                image = Image.FromStream(stream);
            }
            return image;
        }