Class Bitmap

Bitmap class

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

public sealed class Bitmap : ICloneable, IDisposable

Constructors

NameDescription
Bitmap(Bitmap)Initializes a new instance of the Bitmap class from the specified existing image.
Bitmap(Stream)Initializes a new instance of the Bitmap class from the specified data stream.
Bitmap(string)Initializes a new instance of the Bitmap class from the specified file.
Bitmap(Bitmap, Size)Initializes a new instance of the Bitmap class from the specified existing image, scaled to the specified size.
Bitmap(int, int)Initializes a new instance of the Bitmap class with the specified size.
Bitmap(Stream, bool)Initializes a new instance of the Bitmap class from the specified data stream.
Bitmap(string, bool)Initializes a new instance of the Bitmap class from the specified file.
Bitmap(Bitmap, int, int)Initializes a new instance of the Bitmap class from the specified existing image, scaled to the specified size.
Bitmap(int, int, PixelFormat)Initializes a new instance of the Bitmap class with the specified size and format.

Properties

NameDescription
Flags { get; }Gets attribute flags for the pixel data of this Image.
Height { get; }Gets the height, in pixels, of this Image.
HorizontalResolution { get; }Gets the horizontal resolution, in pixels per inch, of this Image.
Palette { get; set; }Gets or sets the color palette used for this Image.
PhysicalDimension { get; }Gets the width and height of this image.
PixelFormat { get; }Gets the pixel format for this Image.
RawFormat { get; }Gets the file format of this Image.
Size { get; }Gets the width and height, in pixels, of this image.
Tag { get; set; }Gets or sets an object that provides additional data about the image.
VerticalResolution { get; }Gets the vertical resolution, in pixels per inch, of this Image.
Width { get; }Gets the width, in pixels, of this Image.

Methods

NameDescription
Clone()Creates an exact copy of this Image.
Clone(RectangleF, PixelFormat)Creates a copy of the section of this Bitmap defined with a specified PixelFormat enumeration.
Dispose()Releases all resources used by this Image.
GetPixel(int, int)Gets the color of the specified pixel in this Bitmap.
LockBits(RectangleF, ImageLockMode, PixelFormat)Locks a Bitmap into system memory.
MakeTransparent()Makes the default transparent color transparent for this Bitmap.
MakeTransparent(Color)Makes the specified color transparent for this Bitmap.
RotateFlip(RotateFlipType)This method rotates, flips, or rotates and flips the Image.
Save(string)Saves this Image to the specified file or stream.
Save(Stream, ImageFormat)Saves this image to the specified stream in the specified format.
Save(string, ImageFormat)Saves this Image to the specified file in the specified format.
SetPixel(int, int, Color)Sets the color of the specified pixel in this Bitmap.
SetResolution(float, float)Sets the resolution for this Bitmap.
UnlockBits(BitmapData)Unlocks this Bitmap from system memory.
static GetPixelFormatSize(PixelFormat)Returns the color depth, in number of bits per pixel, of the specified pixel format.
static IsAlphaPixelFormat(PixelFormat)Returns a value that indicates whether the pixel format for this Image contains alpha information.

See Also