public byte[] ImageToByteArray(Avalonia.Media.Imaging.Bitmap image) { using (MemoryStream stream = new MemoryStream()) { image.Save(stream); return(stream.ToArray()); } }
public static Bitmap ToSystemBitmap(this Avalonia.Media.Imaging.Bitmap bitmap) { using var memoryStream = new MemoryStream(); bitmap.Save(memoryStream); return(new Bitmap(memoryStream)); }