PixelFormatExtensionsGetMatchingQuantizer Method

Gets a PredefinedColorsQuantizer instance that fits for the specified pixelFormat. For indexed formats a default palette will be used.


Namespace: KGySoft.Drawing
Assembly: KGySoft.Drawing (in KGySoft.Drawing.dll) Version: 8.1.0
public static PredefinedColorsQuantizer GetMatchingQuantizer(
	this PixelFormat pixelFormat,
	Color backColor = default,
	byte alphaThreshold = 128


pixelFormat  PixelFormat
The PixelFormat to get a quantizer for.
backColor  Color  (Optional)
Colors with alpha (transparency), which are considered opaque will be blended with this color before quantization. The Color.A property of the background color is ignored. This parameter is optional.
Default value: The bitwise zero instance of Color, which has the same RGB values as Black.
alphaThreshold  Byte  (Optional)
Specifies a threshold value for the Color.A property, under which a quantized color is considered completely transparent. This parameter is optional.
Default value: 128.

Return Value

A PredefinedColorsQuantizer instance that is compatible with the specified pixelFormat.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelFormat. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also