0 out of 3 rated this helpful - Rate this topic

PixelFormat Enumeration

Specifies the format of the color data for each pixel in the image.

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

public enum PixelFormat
public enum PixelFormat
public enum PixelFormat
  Member name Description
Alpha The pixel data contains alpha values that are not premultiplied. 
Canonical The default pixel format of 32 bits per pixel. The format specifies 24-bit color depth and an 8-bit alpha channel. 
DontCare No pixel format is specified. 
Extended Reserved. 
Format16bppArgb1555 The pixel format is 16 bits per pixel. The color information specifies 32,768 shades of color, of which 5 bits are red, 5 bits are green, 5 bits are blue, and 1 bit is alpha. 
Format16bppGrayScale The pixel format is 16 bits per pixel. The color information specifies 65536 shades of gray. 
Supported by the .NET Compact Framework Format16bppRgb555 Specifies that the format is 16 bits per pixel; 5 bits each are used for the red, green, and blue components. The remaining bit is not used. 
Supported by the .NET Compact Framework Format16bppRgb565 Specifies that the format is 16 bits per pixel; 5 bits are used for the red component, 6 bits are used for the green component, and 5 bits are used for the blue component. 
Format1bppIndexed Specifies that the pixel format is 1 bit per pixel and that it uses indexed color. The color table therefore has two colors in it. 
Supported by the .NET Compact Framework Format24bppRgb Specifies that the format is 24 bits per pixel; 8 bits each are used for the red, green, and blue components. 
Format32bppArgb Specifies that the format is 32 bits per pixel; 8 bits each are used for the alpha, red, green, and blue components. 
Format32bppPArgb Specifies that the format is 32 bits per pixel; 8 bits each are used for the alpha, red, green, and blue components. The red, green, and blue components are premultiplied, according to the alpha component. 
Supported by the .NET Compact Framework Format32bppRgb Specifies that the format is 32 bits per pixel; 8 bits each are used for the red, green, and blue components. The remaining 8 bits are not used. 
Format48bppRgb Specifies that the format is 48 bits per pixel; 16 bits each are used for the red, green, and blue components. 
Format4bppIndexed Specifies that the format is 4 bits per pixel, indexed. 
Format64bppArgb Specifies that the format is 64 bits per pixel; 16 bits each are used for the alpha, red, green, and blue components. 
Format64bppPArgb Specifies that the format is 64 bits per pixel; 16 bits each are used for the alpha, red, green, and blue components. The red, green, and blue components are premultiplied according to the alpha component. 
Format8bppIndexed Specifies that the format is 8 bits per pixel, indexed. The color table therefore has 256 colors in it. 
Gdi The pixel data contains GDI colors. 
Indexed The pixel data contains color-indexed values, which means the values are an index to colors in the system color table, as opposed to individual color values. 
Max The maximum value for this enumeration. 
PAlpha The pixel format contains premultiplied alpha values. 
Undefined The pixel format is undefined. 

The pixel format defines the number of bits of memory associated with one pixel of data. The format also defines the order of the color components within a single pixel of data.

PixelFormat48bppRGB, PixelFormat64bppARGB, and PixelFormat64bppPARGB use 16 bits per color component (channel). GDI+ version 1.0 and 1.1 can read 16-bits-per-channel images, but such images are converted to an 8-bits-per-channel format for processing, displaying, and saving. Each 16-bit color channel can hold a value in the range 0 through 2^13.

Some of the pixel formats contain premultiplied color values. Premultiplied means that the color values have already been multiplied by an alpha value.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
8bppIndexed is 8bppgrayscale
If the palette for the image is a greyscale palette, you use Format8BPPIndexed to represent 8bit greyscale images
no 8bppGrayscale PixelFormat?
Why oh why in the world would this be left out?  I'd like to do image processing on mono images and it's a waste of space to keep around 3 planes of data or even 16 bits per pixel.  Isn't this a pretty standard pixel format?  I honestly don't get it.  If anyone has a workaround for this that doesn't involve 8bppIndexed and a grayscale color pallette, I'd really appreciate hearing about it.  Thanks.