nquant's API is very simple. You simply instantiate a class called WuQuantizer with a parameterless constructor and call the one method exposed by IWuQuantizer:
public interface IWuQuantizer
Image QuantizeImage(Bitmap image, int alphaThreshold, int alphaFader);
nQuant takes the bitmap you pass in and returnes a completely new, quantized image with no more than 256 colors. In addition to the source imagem the QuantizeImage method has two optional parameters:
- alphaThreshold - All colors with an Alpha value equal to or less than this integer will be considered fully transparent. The default is 10.
- alphaFader - Alpha values will be normalized to the nearest multiple of this value. The default is 70.
WuQuantizer is stateless and thread safe. You can safely call QuantizeImage several times and from multiple threads on the same instance.
The command line wrapper (nQuant.exe) has a similar calling structure. It must be located in the same directory as nQuant.Core.dll. Its usage is as follows:
usage: nQuant <input image path> [options]
/t : Alpha Thresholds - All colors with an Alpha value equal to or less than this integer will be considered fully transparent. The default is 10.
/f : Alpha Fader - Alpha values will be normalized to the nearest multiple of this value. The default is 70.
/o : Output image file path. The default is <source image path directory>\<source image file name without extension>-quant.png