How to: Convert a BMP image to a PNG image

Oftentimes, you will want to convert from one image file format to another. You can do this conversion easily by calling the Save method of the Image class and specifying the ImageFormat for the desired image file format.

The following example loads a BMP image from a type, and saves the image in the PNG format.

private void SaveBmpAsPNG()
    Bitmap bmp1 = new Bitmap(typeof(Button), "Button.bmp");
    bmp1.Save(@"c:\button.png", ImageFormat.Png);

This example requires:

  • A Windows Forms application.

Community Additions