.NET Framework Class Library
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)
Syntax

Visual Basic (Declaration)
Public Enumeration PixelFormat
Visual Basic (Usage)
Dim instance As PixelFormat
C#
public enum PixelFormat
Visual C++
public enum class PixelFormat
JScript
public enum PixelFormat
Members

Member nameDescription
IndexedThe 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.
GdiThe pixel data contains GDI colors.
AlphaThe pixel data contains alpha values that are not premultiplied.
PAlphaThe pixel format contains premultiplied alpha values.
ExtendedReserved.
CanonicalThe default pixel format of 32 bits per pixel. The format specifies 24-bit color depth and an 8-bit alpha channel.
UndefinedThe pixel format is undefined.
DontCareNo pixel format is specified.
Format1bppIndexedSpecifies that the pixel format is 1 bit per pixel and that it uses indexed color. The color table therefore has two colors in it.
Format4bppIndexedSpecifies that the format is 4 bits per pixel, indexed.
Format8bppIndexedSpecifies that the format is 8 bits per pixel, indexed. The color table therefore has 256 colors in it.
Format16bppGrayScaleThe pixel format is 16 bits per pixel. The color information specifies 65536 shades of gray.
Supported by the .NET Compact FrameworkFormat16bppRgb555Specifies 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 FrameworkFormat16bppRgb565Specifies 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.
Format16bppArgb1555The 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.
Supported by the .NET Compact FrameworkFormat24bppRgbSpecifies that the format is 24 bits per pixel; 8 bits each are used for the red, green, and blue components.
Supported by the .NET Compact FrameworkFormat32bppRgbSpecifies 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.
Format32bppArgbSpecifies that the format is 32 bits per pixel; 8 bits each are used for the alpha, red, green, and blue components.
Format32bppPArgbSpecifies 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.
Format48bppRgbSpecifies that the format is 48 bits per pixel; 16 bits each are used for the red, green, and blue components.
Format64bppArgbSpecifies that the format is 64 bits per pixel; 16 bits each are used for the alpha, red, green, and blue components.
Format64bppPArgbSpecifies 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.
MaxThe maximum value for this enumeration.
Remarks

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.

Platforms

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

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0
See Also

Reference

Tags :


Community Content

The MAZZTer
If you're wondering which values the bitmasks will filter...
Max = 0000000F (Bitmask for actual format values)

My bitmasks:
AttributeMask = FFFF0000
BPPMask = 0000FF00
FormatMask = 000000FF

Defined Attributes (don't set these on arbitrary formats, just check for them):
DontCare = 00000000
Indexed = 00010000
GDI = 00020000
Alpha = 00040000
PAlpha = 00080000
Extended = 00100000
Canonical = 00200000

BPP flags that aren't in the enumeration (don't binary OR to check for them, binary AND with my bitmask above and check for equality, since 24 and 48 use multiple flags):
1BPP = 00000100
2BPP = 00000200
4BPP = 00000400
8BPP = 00000800
16BPP = 00001000
24BPP = 00001800
32BPP = 00002000
48BPP = 00002800
64BPP = 00004000

Defined Formats:
Undefined = 00000000 = 0
1 = 00030101 = 1 1BPP Indexed GDI
4 = 00030402 = 2 4BPP Indexed GDI
8 = 00030803 = 3 8BPP Indexed GDI
16Gray = 00101004 = 4 16BPP Extended
16RGB555 = 00021005 = 5 16BPP GDI
16RGB565 = 00021006 = 6 16BPP GDI
16ARGB1555 = 00061007 = 7 16BPP GDI Alpha
24 = 00021808 = 8 16BPP 8BPP GDI
32RGB = 00022009 = 9 32BPP GDI
32ARGB = 0026200A = A 32BPP GDI Alpha Canonical
32PARGB = 000E200B = B 32BPP GDI Alpha PAlpha
48 = 0010300C = C 32BPP 8BPP Extended
64ARGB = 0034400D = D 64BPP Alpha Extended Canonical
64PARGB = 001C400E = E 64BPP Alpha PAlpha Extended

Yes, the help for Canonical says it's only supposed to be set for 32ARGB but it's set for 64ARGB too.
Tags :

Page view tracker