Need Paper Mache

    img-to-palette

    1.0.1 • Public • Published

    img-to-palette

    Given an image, extracts the color palette using the median-cut algorithm.

    Screenshot: Viktor's Juric taken from unsplash

    Usage

    NPM

    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

    Install

    npm i img-to-palette

    DownloadsWeekly Downloads

    1

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    4.76 kB

    Total Files

    4

    Last publish

    Collaborators

    • evangl