This documentation is archived and is not being maintained.
PixelFormats Class
Visual Studio 2010
Represents the collection of supported pixel formats.
Assembly: PresentationCore (in PresentationCore.dll)
The PixelFormats type exposes the following members.
| Name | Description | |
|---|---|---|
![]() ![]() | Bgr101010 | Gets the Bgr101010 pixel format. Bgr101010 is a sRGB format with 32 bits per pixel (BPP). Each color channel (blue, green, and red) is allocated 10 bits per pixel (BPP). |
![]() ![]() | Bgr24 | Gets the Bgr24 pixel format. Bgr24 is a sRGB format with 24 bits per pixel (BPP). Each color channel (blue, green, and red) is allocated 8 bits per pixel (BPP). |
![]() ![]() | Bgr32 | Gets the Bgr32 pixel format. Bgr32 is a sRGB format with 32 bits per pixel (BPP). Each color channel (blue, green, and red) is allocated 8 bits per pixel (BPP). |
![]() ![]() | Bgr555 | Gets the Bgr555 pixel format. Bgr555 is a sRGB format with 16 bits per pixel (BPP). Each color channel (blue, green, and red) is allocated 5 bits per pixel (BPP). |
![]() ![]() | Bgr565 | Gets the Bgr565 pixel format. Bgr565 is a sRGB format with 16 bits per pixel (BPP). Each color channel (blue, green, and red) is allocated 5, 6, and 5 bits per pixel (BPP) respectively. |
![]() ![]() | Bgra32 | Gets the Bgra32 pixel format. Bgra32 is a sRGB format with 32 bits per pixel (BPP). Each channel (blue, green, red, and alpha) is allocated 8 bits per pixel (BPP). |
![]() ![]() | BlackWhite | Gets the black and white pixel format which displays one bit of data per pixel as either black or white. |
![]() ![]() | Cmyk32 | Gets the Cmyk32 pixel format which displays 32 bits per pixel (BPP) with each color channel (cyan, magenta, yellow, and black) allocated 8 bits per pixel (BPP). |
![]() ![]() | Default | Gets the pixel format that is best suited for the particular operation. |
![]() ![]() | Gray16 | Gets the Gray16 pixel format which displays a 16 bits-per-pixel grayscale channel, allowing 65536 shades of gray. This format has a gamma of 1.0. |
![]() ![]() | Gray2 | Gets the Gray2 pixel format which displays a 2 bits-per-pixel grayscale channel, allowing 4 shades of gray. |
![]() ![]() | Gray32Float | Gets the Gray32Float pixel format. Gray32Float displays a 32 bits per pixel (BPP) grayscale channel, allowing over 4 billion shades of gray. This format has a gamma of 1.0. |
![]() ![]() | Gray4 | Gets the Gray4 pixel format which displays a 4 bits-per-pixel grayscale channel, allowing 16 shades of gray. |
![]() ![]() | Gray8 | Gets the Gray8 pixel format which displays an 8 bits-per-pixel grayscale channel, allowing 256 shades of gray. |
![]() ![]() | Indexed1 | Gets the pixel format specifying a paletted bitmap with 2 colors. |
![]() ![]() | Indexed2 | Gets the pixel format specifying a paletted bitmap with 4 colors. |
![]() ![]() | Indexed4 | Gets the pixel format specifying a paletted bitmap with 16 colors. |
![]() ![]() | Indexed8 | Gets the pixel format specifying a paletted bitmap with 256 colors. |
![]() ![]() | Pbgra32 | Gets the Pbgra32 pixel format. Pbgra32 is a sRGB format with 32 bits per pixel (BPP). Each channel (blue, green, red, and alpha) is allocated 8 bits per pixel (BPP). Each color channel is pre-multiplied by the alpha value. |
![]() ![]() | Prgba128Float | Gets the Prgba128Float pixel format. Prgba128Float is a ScRGB format with 128 bits per pixel (BPP). Each channel (red, green, blue, and alpha) is allocated 32 bits per pixel (BPP). Each color channel is pre-multiplied by the alpha value. This format has a gamma of 1.0. |
![]() ![]() | Prgba64 | Gets the Prgba64 pixel format. Prgba64 is a sRGB format with 64 bits per pixel (BPP). Each channel (blue, green, red, and alpha) is allocated 32 bits per pixel (BPP). Each color channel is pre-multiplied by the alpha value. This format has a gamma of 1.0. |
![]() ![]() | Rgb128Float | Gets the Rgb128Float pixel format. Rgb128Float is a ScRGB format with 128 bits per pixel (BPP). Each color channel is allocated 32 BPP. This format has a gamma of 1.0. |
![]() ![]() | Rgb24 | Gets the Rgb24 pixel format. Rgb24 is a sRGB format with 24 bits per pixel (BPP). Each color channel (red, green, and blue) is allocated 8 bits per pixel (BPP). |
![]() ![]() | Rgb48 | Gets the Rgb48 pixel format. Rgb48 is a sRGB format with 48 bits per pixel (BPP). Each color channel (red, green, and blue) is allocated 16 bits per pixel (BPP). This format has a gamma of 1.0. |
![]() ![]() | Rgba128Float | Gets the Rgba128Float pixel format. Rgba128Float is a ScRGB format with 128 bits per pixel (BPP). Each color channel is allocated 32 bits per pixel (BPP). This format has a gamma of 1.0. |
![]() ![]() | Rgba64 | Gets the Rgba64 pixel format. Rgba64 is an sRGB format with 64 bits per pixel (BPP). Each channel (red, green, blue, and alpha) is allocated 16 bits per pixel (BPP). This format has a gamma of 1.0. |
This example shows how to convert an image to grayscale using FormatConvertedBitmap.
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Page.Resources> <!-- This resource defines a BitmapImage with a source and a DecodePixelWidth of 200. This property is set to the same value as the desired width of the image to save on memory use. This BitmapImage is used as the base for the other BitmapSource resources. --> <BitmapImage x:Key="masterImage" DecodePixelWidth="200" UriSource="C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Forest.jpg"/> <!-- This FormatConvertedBitmap uses the BitmapImage defined above and changes the format to Gray32Float (grayscale). --> <FormatConvertedBitmap x:Key="convertFormatImage" Source="{StaticResource masterImage}" DestinationFormat="Gray32Float" /> </Page.Resources> <StackPanel> <!-- Apply the "convertFormatImage" resource defined above to this image. --> <Image Width="200" Source="{StaticResource convertFormatImage}" /> </StackPanel> </Page>
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show:
