public Bitmap ToBitmap(ImageFormat imageFormat) { Format = MagickFormatInfo.GetFormat(imageFormat); MemoryStream memStream = new MemoryStream(); Write(memStream); memStream.Position = 0; /* Do not dispose the memStream, the bitmap owns it. */ return new Bitmap(memStream); }
private static void Test_ToBitmap(MagickImage image, ImageFormat format) { using (Bitmap bmp = image.ToBitmap(format)) { Assert.AreEqual(format, bmp.RawFormat); } }