public static Texture2D ToTexture(this Image image, GraphicsDevice device) { Texture2D texture = null; using (var stream = new MemoryStream()) { image.Save(stream, ImageFormat.Png); stream.Seek(0, SeekOrigin.Begin); texture = Texture2D.FromStream(device, stream); } return texture; }