Closed NnWinter closed 2 years ago
As I don't know how you load image and which pixel format it has, but here is example for Rgba32:
using var image = Image.Load<Rgba32>(@"/path/to/image.jpg");
// Copy to bytes
byte[] pixelBytes = new byte[image.Width * image.Height * Unsafe.SizeOf<Rgba32>()];
image.CopyPixelDataTo(pixelBytes);
var imageData = ImageData.FromArray(pixelBytes, ImagePixelFormat.Rgba32, image.Width, image.Height);
// Do something with ImageData
Replace Rgba32 with Rgb32 or another px format.
Thanks!that's exactly what I needed!
An ImageSharp image as var img = new Image(size.Width, size.Height);
file.Video.AddFrame() need ImageData
How does it convert?