---
title: "PixelFormatConverter Class"
canonical: https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Transforms_PixelFormatConverter.htm
product: "Graphics Mill 5.5 for .NET"
---

This documentation is for the old version. [Go to the latest Graphics Mill docs](https://www.graphicsmill.com/docs/gm/)

# PixelFormatConverter Class
 
This class enables you to convert a bitmap from one pixel format to another one.
 
**Namespace:** [Aurigma.GraphicsMill.Transforms](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Transforms.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```
Public NotInheritable Class PixelFormatConverter _Inherits BitmapTransform
```
 
```csharp
public sealed class PixelFormatConverter : BitmapTransform
```
 
## Remarks
  
Using this class you can modify pixel format of the bitmap. To specify new pixel format use property [DestinationPixelFormat](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Transforms_PixelFormatConverter_DestinationPixelFormat.htm.md). Pixel formats can be divided into two big groups - indexed and continuous ones. These groups has different set of settings.
 
Indexed pixel formats are defined in the following way: colors are stores in a special table called *palette*. Pixels in such images are indexes in the palette (pointing this way to the necessary color). When bit depth of this pixel format is 1 bpp (bits per pixel), the palette can contain only 2 colors, 4 bpp - 16 colors, and 8 bpp - 256 colors. When you convert the image to indexed pixel format, you should specify how to produce the palette. You can do it using [PaletteType](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Transforms_PixelFormatConverter_PaletteType.htm.md) property. You also may need to specify a number of entries in the palette (the less colors number the image has, the better compression characteristics does it have).
 
Number of colors in the palette are closely concerned with another block of settings. When we reducing number of colors (for example, when we convert from 24 bpp image to 8 bpp, we convert 16 millions of colors to 256 ones), the colors are usually noticeable distorted. Multiple hues (halftones) of some color are converted to single colors, gradients are turned into areas filled with solid color. To decrease this effect, special technique called *dithering* is used. The idea is to emulate halftones by spreading pixels of the palette with different density. Human eye perceives it as a new color. There are multiple dithering algorithms are available. You can select one of them with [Dithering](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Transforms_PixelFormatConverter_Dithering.htm.md) property. You can also specify dithering intensity with [DitheringIntensity](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Transforms_PixelFormatConverter_DitheringIntensity.htm.md) property.
 
Continuous pixel formats are organized in another way. Pixels are constructed from one or more color channels. Each color channel contains a value that specifies this channel luminosity. A set of color channels depends on the image *color space*. Currently Graphics Mill for .NET supports such color spaces as RGB, CMYK, and grayscale. Conversion between color spaces is not unambiguous, and that's why colors may get distorted during conversion. To resolve this problem, color management is used. Color management is performed with a help of *color profiles*. Two color profiles should be defined - input profile and output profile. Input profile is always taken from the source bitmap ([ColorProfile](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Bitmap_ColorProfile.htm.md) property of the [Bitmap](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Bitmap.htm.md) class), output profile is set for each target color space via [CmykColorProfile](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Transforms_PixelFormatConverter_CmykColorProfile.htm.md), [RgbColorProfile](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Transforms_PixelFormatConverter_RgbColorProfile.htm.md), and [GrayScaleColorProfile](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Transforms_PixelFormatConverter_GrayScaleColorProfile.htm.md) correspondingly. You can also specify so-called *rendering intent* using [TransformationIntent](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Transforms_PixelFormatConverter_TransformationIntent.htm.md) property. Rendering intent allows to tell the algorithm what color parameters are most important to you and what one can be discarded. If you do not care about color transformation precision and prefer higher speed, you can disable color management (set the [ColorManagementEngine](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Transforms_PixelFormatConverter_ColorManagementEngine.htm.md) property to [None](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Transforms_ColorManagementEngine.htm.md)).
 
Another nuance you should keep in mind is handling the situation when source pixel format had alpha channel, but the destination one - has not and vice versa. The table below describes how this problem is resolved with this class.
 
|  Has Alpha |  How to Resolve |
| --- | --- |
 |  Both **source** and **destination**. |  No specific action should be performed. |
 |  Only **source**. |  As destination pixel format has no alpha channel, we should remove alpha information from the source bitmap. We can either discard alpha channel, or emulate it by blending the source bitmap with some background color. If property [BackgroundEnabled](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Transforms_PixelFormatConverter_BackgroundEnabled.htm.md) is set to **true**, the algorithm blends the source image with the color specified with [BackgroundColor](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Transforms_PixelFormatConverter_BackgroundColor.htm.md) property. Otherwise alpha channel is just ignored. |
 |  Only **destination**. |  In case when source bitmap does not have alpha channel information, but we need to add it during conversion, the only thing we should know is an initial value for the alpha channel. It is specified with [Opacity](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Transforms_PixelFormatConverter_Opacity.htm.md) property. |
 |  Neither source nor destination. |  No specific action should be performed. |
 
## Inheritance Hierarchy
  
- [System.Object](http://msdn2.microsoft.com/en-us/e5kfa45b)
    - [Aurigma.GraphicsMill.SyncHandler](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_SyncHandler.htm.md)
        - [Aurigma.GraphicsMill.UnitConverterHandler](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_UnitConverterHandler.htm.md)
            - [Aurigma.GraphicsMill.Transforms.BitmapTransform](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Transforms_BitmapTransform.htm.md)
                - Aurigma.GraphicsMill.Transforms.PixelFormatConverter
 
## Thread Safety
 Static members of this type are safe for multi-threaded operations. Instance members of this type are safe for multi-threaded operations.
 
## Object Model

[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_88.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Transforms_PixelFormatConverter.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_89.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_ColorProfile.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_90.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_ColorPalette.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_91.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_ColorProfile.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_92.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_ColorProfile.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel1.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_93.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_ColorProfile.htm.md)
 
## Supported Pixel Formats

| Member Name | Description |
| --- | --- |
| **Format1bppIndexed** | 1 bit per pixel. Indexed. |
| **Format4bppIndexed** | 4 bits per pixel. Indexed. |
| **Format8bppIndexed** | 8 bits per pixel. Indexed. |
| **Format8bppGrayScale** | 8 bits per pixel. Grayscale. 8 bits are used for luminosity level. |
| **Format16bppGrayScale** | 16 bits per pixel. Grayscale. All 16 bits are used for luminosity level (extended pixel format). |
| **Format16bppAGrayScale** | 16 bits per pixel. Grayscale with alpha channel. 8 bits are used for alpha channel and other 8 bits are used for luminosity level. |
| **Format32bppAGrayScale** | 32 bits per pixel. Grayscale with alpha channel. 16 bits are used for alpha channel and other 16 bits are used for luminosity level (extended pixel format). |
| **Format16bppRgb565** | 16 bits per pixel. RGB. 5 bits each are used for the red, and blue components. 6 bits are used for green component. |
| **Format16bppRgb555** | 16 bits per pixel. RGB. 5 bits each are used for the red, green, and blue components. The rest bit is unused. |
| **Format16bppArgb1555** | 16 bits per pixel. RGB with alpha channel. 1 bit is used for the alpha component, and 5 bits each are used for the red, green, and blue components. |
| **Format24bppRgb** | 24 bits per pixel. RGB. 8 bits each are used for the red, green, and blue components. |
| **Format32bppRgb** | 32 bits per pixel. RGB. 8 bits each are used for the red, green, and blue components. The rest 8 bits are unused. |
| **Format32bppArgb** | 32 bits per pixel. RGB with alpha channel. 8 bits each are used for the alpha, red, green, and blue components. |
| **Format48bppRgb** | 48 bits per pixel. RGB. 16 bits each are used for the red, green, and blue components (extended pixel format). |
| **Format64bppArgb** | 64 bits per pixel. RGB with alpha channel. 16 bits each are used for the alpha, red, green, and blue components (extended pixel format). |
| **Format32bppCmyk** | 32 bits per pixel. CMYK. 8 bits each are used for the cyan, magenta, yellow, and black components. |
| **Format40bppAcmyk** | 40 bits per pixel. CMYK with alpha channel. 8 bits each are used for the alpha, cyan, magenta, yellow, and black components. |
| **Format64bppCmyk** | 64 bits per pixel. CMYK. 16 bits each are used for the cyan, magenta, yellow, and black components (extended pixel format). |
| **Format80bppAcmyk** | 80 bits per pixel. CMYK with alpha channel. 16 bits each are used for the alpha, cyan, magenta, yellow, and black components (extended pixel format). |
 
## See Also

### Reference

- [PixelFormatConverter Members](https://www.graphicsmill.com/docs/gm5/AllMembers_T_Aurigma_GraphicsMill_Transforms_PixelFormatConverter.htm.md)
- [Aurigma.GraphicsMill.Transforms Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Transforms.htm.md)
