O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Convert the Format of an Image

Problem

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

Solution

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

Discussion

.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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required