Socket
Socket
Sign inDemoInstall

image-palette

Package Overview
Dependencies
39
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    image-palette

Get palette for any image file, no node-canvas


Version published
Weekly downloads
92K
increased by7.76%
Maintainers
2
Install size
330 kB
Created
Weekly downloads
 

Readme

Source

image-palette Build Status unstable

Extract palette from pixels array, return pixels mapped to palette. Useful for organizing palette-based encoding, like GIF, or various limited colors renderers, like gl-scatter2d.

Inspired by get-rgba-palette.

Usage

$ npm install image-palette

var palette = require('image-palette')
var pixels = require('image-pixels')

var {ids, colors} = palette(await pixels('./image.png'))

API

var {ids, colors, amount} = palette(pixels, count=5)

Extract palette from the input pixels array with rgba pixels sequence, whether flat or nested.

  • colors is a list of extracted colors [[r, g, b, a], [r, g, b, a], ...].
  • ids is an array of input pixels mapped to extracted colors.
  • amount is an array with amounts corresponding to the extracted colors, from 0..1 range.
  • count is max number of colors to extract.
  • image-pixels − load pixels data from any image source.
  • image-save − save image/pixel data to a file, canvas or array.
  • image-equal − test if two images are equal, based on fuzzy comparison.

License

© 2018 Dmitry Yv. MIT License.

Keywords

FAQs

Last updated on 13 Nov 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc