palettext

1.0.4 • Public • Published

Palettext

Colors extract from image

Usage

Code

npm i palettext --save
const palettext = require('palettext');

let data = [/*...load 32 bit RGBA data...*/];
// i. e. CanvasRenderingContext2D.getImageData()
// i. e. Node.js Buffer (pngjs,...)
// i. e. Or simple array
let result = palettext(data, {qtyMax: 16});

Command line

npm i -g palettext
palettext --colors=16 in.png
palettext --colors=16 --format=json in.png >out.json

Options

  • qtyMax/--colors [default: 16] - maximum number of colors to search
  • fixed/--fixed [default: []] - fixed colors
  • colorspace/--colorspace [default: 'lab'] - working colorspace (rgb, xyz or lab)
  • threshold/--threshold [default: 0.2] - cutoff threshold for rare colors
  • stopIncQty/--stop [default: 3] - number of steps with an increasing value to stop
  • maxIterations/--steps [default: 100] - maximum number of steps
  • width/ - width of image

Readme

Keywords

none

Package Sidebar

Install

npm i palettext

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

19.9 kB

Total Files

5

Last publish

Collaborators

  • paulzi