This documentation is archived and is not being maintained.

Bitmap Class

Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes. A Bitmap is an object used to work with images defined by pixel data.

Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)

public sealed class Bitmap : Image
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public final class Bitmap extends Image
public final class Bitmap extends Image
Not applicable.

A bitmap consists of the pixel data for a graphics image and its attributes. There are many standard formats for saving a bitmap to a file. GDI+ supports the following file formats: BMP, GIF, EXIG, JPG, PNG and TIFF. For more information about supported formats, see Types of Bitmaps.

You can create images from files, streams, and other sources by using one of the Bitmap constructors and save them to a stream or to the file system with the Save method. Images are drawn to the screen or to memory by using the DrawImage method of the Graphics object. For a list of topics about working with image files, see Working with Images, Bitmaps, and Metafiles.


The Bitmap class is not accessible across application domains. For example, if you create a dynamic AppDomain and create several brushes, pens, and bitmaps in that domain, then pass these objects back to the main application domain, you can successfully use the pens and brushes. However, if you call the DrawImage method to draw the marshaled Bitmap, you receive the following exception.

Remoting cannot find field "native image" on type "System.Drawing.Image".

The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. The code performs the following actions:

  • Creates an image from the SampImag.jpg file in the folder of the example.

  • Creates a point at which to draw the upper-left corner of the image.

  • Draws the unscaled image to the screen.

private void DrawImagePoint(PaintEventArgs e)
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
    // Create Point for upper-left corner of image.
    Point ulCorner = new Point(100, 100);
    // Draw image to screen.
    e.Graphics.DrawImage(newImage, ulCorner);




.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0