Click or drag to resize
Accord.NET (logo)

ColorImageQuantizerReduceColors Method (UnmanagedImage, Color)

Create an image with reduced number of colors using the specified palette.

Namespace:  Accord.Imaging.ColorReduction
Assembly:  Accord.Imaging (in Accord.Imaging.dll) Version: 3.6.0
public Bitmap ReduceColors(
	UnmanagedImage image,
	Color[] palette
Request Example View Source


Type: Accord.ImagingUnmanagedImage
Source image to process.
Type: System.DrawingColor
Target color palette. Must contatin 2-256 colors.

Return Value

Type: Bitmap
Returns image with reduced number of colors.
UnsupportedImageFormatExceptionUnsupported format of the source image - it must 24 or 32 bpp color image.
ArgumentExceptionInvalid size of the target color palette.

The method creates an image, which looks similar to the specified image, but contains reduced number of colors. Is substitutes every pixel of the source image with the closest matching color in the specified paletter.

Note Note
The output image has 4 bpp or 8 bpp indexed pixel format depending on the target palette size - 4 bpp for palette size 16 or less; 8 bpp otherwise.

See Also