Skip to content

A .Net color quantizer based on Xiaolin Wu's Color Quantizer. For a given 32-bit RGB or ARGB image, it will produce a 8-bit palletized image.

License

Notifications You must be signed in to change notification settings

JeremyAnsel/JeremyAnsel.ColorQuant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JeremyAnsel.ColorQuant

Build status Code coverage NuGet Version License

JeremyAnsel.ColorQuant is a C# implementation of the Xiaolin Wu's Color Quantizer (v. 2). For a given 32-bit RGB or ARGB image, it will produce a 8-bit palletized image.

Description Value
License The MIT License (MIT)
Documentation http://jeremyansel.github.io/JeremyAnsel.ColorQuant
Code coverage https://jeremyansel.github.io/JeremyAnsel.ColorQuant/coverage/
Source code https://github.com/JeremyAnsel/JeremyAnsel.ColorQuant
Nuget https://www.nuget.org/packages/JeremyAnsel.ColorQuant
Build https://ci.appveyor.com/project/JeremyAnsel/jeremyansel-colorquant/branch/master

C Implementation of Xiaolin Wu's Color Quantizer (v. 2) (see Graphics Gems volume II, pages 126-133) : http://www.ece.mcmaster.ca/~xwu/cq.c.

Algorithm: Greedy orthogonal bipartition of RGB space for variance minimization aided by inclusion-exclusion tricks. For speed no nearest neighbor search is done. Slightly better performance can be expected by more sophisticated but more expensive versions.

Usage

For image with RGB data:

var quantizer = new WuColorQuantizer();
ColorQuantizerResult result = quantizer.Quantize(image, colorCount);

For image with ARGB data:

var quantizer = new WuAlphaColorQuantizer();
ColorQuantizerResult result = quantizer.Quantize(image, colorCount);

ColorQuantizerResult contains a palette and the result bytes.

About

A .Net color quantizer based on Xiaolin Wu's Color Quantizer. For a given 32-bit RGB or ARGB image, it will produce a 8-bit palletized image.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published