Use this constructor to open images with the following file formats: BMP, GIF, EXIF, JPG, PNG and TIFF. For more information about supported formats, see Types of Bitmaps. The file remains locked until the Bitmap is disposed.
The following code example demonstrates how to construct a new bitmap from a file. The example uses the GetPixel and SetPixel methods to recolor the image. It also uses the PixelFormat property.
This example is designed to be used with a Windows Form that contains a Label, PictureBox and Button named Label1, PictureBox1 and Button1, respectively. Paste the code into the form and associate the Button1_Click method with the button's Click event.