This documentation is for the old version. Go to the latest Graphics Mill docs

CustomFormatWriter.GetClosestPixelFormat Method

Get a pixel format supported by this writer closest to the specified one.

Namespace: Aurigma.GraphicsMill.Codecs
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)

Syntax

Visual Basic
Protected Friend MustOverride Function GetClosestPixelFormat ( _
	pixelFormat As PixelFormat _
) As PixelFormat
C#
protected internal abstract PixelFormat GetClosestPixelFormat(
	PixelFormat pixelFormat
)

Parameters

pixelFormat

Type: Aurigma.GraphicsMill.PixelFormat

PixelFormat enumeration member that specifies the pixel format you would like to get a closest pixel format of this codec for.

Return Value

PixelFormat enumeration member that specifies the closest pixel format supported by the writer comparing to the specified one.

Remarks

This method is used to automate conversion of the bitmap before saving it.

Imagine, that your file format supports only 24-bit RGB and 32-bit CMYK. If the user tries to save, say, 8-bit indexed image, obviously you should convert it to 24-bit RGB. But for 40-bit ACMYK bitmap, you should convert to 32-bit CMYK (to avoid color losses during conversion between CMYK and RGB).

Examples

C#
protected override PixelFormat GetClosestPixelFormat(PixelFormat pixelFormat)
{
    PixelFormat closestFormat;
    
    //...Select the format based on some criteria and assign the result to the
    //closestFormat variable...
    
    return closestFormat;
}

See Also

Reference