Color extraction library. In TypeScript/JavaScript. For browser/server.
- small size, 1kB (minified + gzipped)
- pretty fast, 512×512 pixels in ~50ms, 340×340 pixels in ~15ms (~6× slower on mobile)
- scans every pixel
- identical output for rotated images
- sampled by top 2 bits of 3 groups: H, L, and luminance
- calculates average per group
- fixed memory footprint, samples using 2 (bits) ^ 3 (groups) * 4 (RGB + count) * 4 (Uint32) = 1024 bytes
- usually generates small (~16 colors) palette of main colors
- supports RGB and RGBA input pixel array (compatible with ImageData.data)
- using TypedArray
- no native dependencies
- lokesh/color-thief
- leeoniya/RgbQuant.js
- nrabinowitz/quantize.js
- igor-bezkrovny/image-quantization
- NeuQuant
- quantization keyword in npm
- pngquant
- Adobe Color CC
npm install colorgram
See test folder.