Click or drag to resize
Accord.NET (logo)

ColorImageQuantizer Class

Color quantization tools.
Inheritance Hierarchy
SystemObject
  Accord.Imaging.ColorReductionColorImageQuantizer

Namespace:  Accord.Imaging.ColorReduction
Assembly:  Accord.Imaging (in Accord.Imaging.dll) Version: 3.8.0
Syntax
public class ColorImageQuantizer
Request Example View Source

The ColorImageQuantizer type exposes the following members.

Constructors
  NameDescription
Public methodColorImageQuantizer
Initializes a new instance of the ColorImageQuantizer class.
Top
Properties
  NameDescription
Public propertyQuantizer
Color quantization algorithm used by this class to build color palettes for the specified images.
Public propertyUseCaching
Use color caching during color reduction or not.
Top
Methods
  NameDescription
Public methodCalculatePalette(Bitmap, Int32)
Calculate reduced color palette for the specified image.
Public methodCalculatePalette(UnmanagedImage, Int32)
Calculate reduced color palette for the specified image.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodReduceColors(Bitmap, Color)
Create an image with reduced number of colors using the specified palette.
Public methodReduceColors(Bitmap, Int32)
Create an image with reduced number of colors.
Public methodReduceColors(UnmanagedImage, Color)
Create an image with reduced number of colors using the specified palette.
Public methodReduceColors(UnmanagedImage, Int32)
Create an image with reduced number of colors.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodTo(Type)Overloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Public Extension MethodToTOverloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Top
Remarks

The class contains methods aimed to simplify work with color quantization algorithms implementing IColorQuantizer interface. Using its methods it is possible to calculate reduced color palette for the specified image or reduce colors to the specified number.

Sample usage:

// instantiate the images' color quantization class
ColorImageQuantizer ciq = new ColorImageQuantizer( new MedianCutQuantizer( ) );
// get 16 color palette for a given image
Color[] colorTable = ciq.CalculatePalette( image, 16 );

// ... or just reduce colors in the specified image
Bitmap newImage = ciq.ReduceColors( image, 16 );

Initial image:

Result image:

See Also