img-to-palette
v1.0.1
Published
Given an image, extracts the color palette.
Downloads
21
Maintainers
Readme
img-to-palette
Given an image, extracts the color palette using the median-cut algorithm.
Screenshot: Viktor's Juric taken from unsplash
Usage
Takes as an argument an image object <img>
and returns an array of 8 RGB colors in the form of [[r, g, b], [r, g, b] .....]
imgToPalette(image)
let imgToPalette = require('img-to-palette')
let rgbArray = imgToPalette(image)
console.log(rgbArray) // [[14, 7, 27], [34, 17, 31] ....]
console.log(rgbArray.length) // 8
License
MIT