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;
}