quantize
Node.js module for color quantization, based on Leptonica.
Install
npm install quantize
Quick Overview
Usage
var quantize = ; var arrayOfPixels = 190197190 202204200 207214210 211214211 205207207;var maximumColorCount = 4; var colorMap = ;
arrayOfPixels
- An array of pixels (represented as [R,G,B arrays]) to quantizemaxiumColorCount
- The maximum number of colours allowed in the reduced palette
Reduced Palette
The .palette()
method returns an array that contains the reduced color palette.
// Returns the reduced palettecolorMap; // [[204, 204, 204], [208,212,212], [188,196,188], [212,204,196]]
Reduced pixel
The .map(pixel)
method maps an individual pixel to the reduced color palette.
// Returns the reduced pixelcolorMap;// [188,196,188]
Author
Contributors
License
Licensed under the MIT License.