Convert the Format of an Image


You want to batch convert the format of one or more image files.


Use the Image.FromFile method to load the image, and use the Image.Save method overload that allows you to specify a new ImageFormat.


.NET includes an impressive set of image-processing features. The core class is System.Drawing.Image, which allows you to open and save multiple types of images. The Image class supports the following formats:

  • Bitmap (BMP)

  • Enhanced Windows metafile image (EMF)

  • Exchangeable Image File (EXIF)

  • Graphics Interchange Format (GIF)

  • Windows icon (ICO)

  • Joint Photographic Experts Group (JPEG)

  • Memory bitmap (BMP)

  • W3C Portable Network Graphics (PNG)

  • Tag Image File Format (TIFF)

  • Windows metafile (WMF)

These formats are ...

Get Microsoft® Visual Basic® .NET Programmer's Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.