ImageMagick.MagickImage.ToBitmap C# (CSharp) Method

ToBitmap() public method

Converts this instance to a Bitmap using the specified ImageFormat. Supported formats are: Bmp, Gif, Icon, Jpeg, Png, Tiff.
public ToBitmap ( ImageFormat imageFormat ) : Bitmap
imageFormat ImageFormat The image format.
return Bitmap
    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);
    }

Same methods

MagickImage::ToBitmap ( ) : Bitmap

Usage Example

Example #1
0
 private static void Test_ToBitmap(MagickImage image, ImageFormat format)
 {
   using (Bitmap bmp = image.ToBitmap(format))
   {
     Assert.AreEqual(format, bmp.RawFormat);
   }
 }
All Usage Examples Of ImageMagick.MagickImage::ToBitmap