colortaker

1.0.2 • Public • Published

🎨 colortaker 🖼️ ➡️ 🖌️🎨

Take an image and print a palette with the most prominent colors.

Image Palette
guitar palette

Install and use the command line

git clone https://github.com/pabrodez/colortaker
cd colortake
npm install

The command takes the arguments: path of your pic, the number of colors in the palette and the palette destination name

For example:

npm run getPalette --- gibson.jpg 4 palette.png

Will give you the example palette.

Or use the module

npm install colortaker
const {printPalette} = require('colortaker')
printPalette('guitar.jpg', 4, 'palette.png')

The Median cut algorithm was implemented as follows:

  1. Take an array of objects containing RGB of each pixel
  2. Find the range of values for each of the three color channel accross pixels in the array
  3. Take the channel with largest range
  4. Find the median value for that channel
  5. Split the pixels in array in two: below the median of that channel and above it
  6. Repeat recursevily until we get N groups
  7. Get average of each group

Credits to:

Package Sidebar

Install

npm i colortaker

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

3.26 MB

Total Files

9

Last publish

Collaborators

  • pabrodez