- Aurigma Graphics Mill 5.5 for .NET
- Introduction
- What's New?
- Overview of Features
- Getting Started
- Programming with Graphics Mill for .NET
- File Formats
- Graphics Mill for .NET Add-ons
- Class Library Reference
- Aurigma.GraphicsMill Namespace
- Aurigma.GraphicsMill.AjaxControls Namespace
- Aurigma.GraphicsMill.AjaxControls.VectorObjects Namespace
- Aurigma.GraphicsMill.AjaxControls.VectorObjects.Math Namespace
- Aurigma.GraphicsMill.AjaxControls.VectorObjects.RedoUndo Namespace
- Aurigma.GraphicsMill.Codecs Namespace
- Aurigma.GraphicsMill.Drawing Namespace
- Aurigma.GraphicsMill.Licensing Namespace
- Aurigma.GraphicsMill.Transforms Namespace
- AddNoise Class
- AdjustHsl Class
- ApplyLut Class
- ApplyMatrixTransform Class
- BitmapTransform Class
- Blur Class
- BlurType Enumeration
- Brightness Class
- BrightnessContrast Class
- Buttonize Class
- ChannelBalance Class
- ColorManagementEngine Enumeration
- ColorQuantizationAlgorithm Enumeration
- ColorTransformationIntent Enumeration
- CombineMode Enumeration
- Combiner Class
- Contrast Class
- Crop Class
- Curves Class
- Cylindrize Class
- Direction Enumeration
- DistributionKind Enumeration
- DitheringType Enumeration
- EdgeDetect Class
- EdgeDetectMode Enumeration
- Emboss Class
- FadeType Enumeration
- FloodFill Class
- FloodFillMode Enumeration
- Glow Class
- HistogramEqualize Class
- InterpolationMode Enumeration
- Invert Class
- Levels Class
- Lut Class
- MaskedBitmapTransform Class
- Matrix Class
- MaximumFilter Class
- MedianFilter Class
- MinimumFilter Class
- Mosaic Class
- Orientation Enumeration
- PageCurl Class
- PerChannelBitmapTransform Class
- PixelFormatConverter Class
- RedEyeBlob Class
- RedEyeMask Class
- RedEyeRemoval Class
- RedEyeRemovalMode Enumeration
- Resize Class
- ResizeMode Enumeration
- Rotate Class
- RotateAndFlip Class
- Shadow Class
- Sharpen Class
- Solarize Class
- Spray Class
- SwapChannels Class
- Swirl Class
- Texturize Class
- Transparentize Class
- UnsharpMask Class
- Waddle Class
- WaterDrop Class
- Wave Class
- WaveType Enumeration
- Aurigma.GraphicsMill.WebControls Namespace
- Aurigma.GraphicsMill.WinControls Namespace
- GraphicsMill Namespace (Client Class Library)
- Aurigma.GraphicsMill.AjaxControls Namespace (Client Class Library)
- Aurigma.GraphicsMill.AjaxControls.VectorObjects Namespace (Client Class Library)
- Aurigma.GraphicsMill.AjaxControls.VectorObjects.Math Namespace (Client Class Library)
- Aurigma.GraphicsMill.AjaxControls.VectorObjects.RedoUndo Namespace (Client Class Library)
- Samples
- Licensing
- Copyright Notices
PixelFormatConverter Class
This class enables you to convert a bitmap from one pixel format to another one.
Namespace:
Aurigma.GraphicsMill.Transforms
Assembly:
Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
Syntax
Public NotInheritable Class PixelFormatConverter _
Inherits BitmapTransform
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. 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 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 property. You can also specify dithering intensity with DitheringIntensity 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 property of the Bitmap class), output profile is set for each target color space via CmykColorProfile, RgbColorProfile, and GrayScaleColorProfile correspondingly. You can also specify so-called rendering intent using TransformationIntent 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 property to None).
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 is set to true, the algorithm blends the source image with the color specified with BackgroundColor 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 property. |
| Neither source nor destination. | No specific action should be performed. |
Inheritance Hierarchy
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











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). |