ezekeal / ez-pixel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ez-pixel

npm downloads js-standard-style Build Status

Takes in an image resizes it and spits it out pixel by pixel

A utility function for sending pixel data to an rgb led matrix with an optional console preview.

js-standard-style

Usage

NPM

ezPixel([width, height])

constructor with optional display width and height defaults to 64 x 64

ezPixel.map(imagePath, cb, log)

  • imports the image at imagePath
  • resizes it to width and height given in the constructor
  • runs the callback function passing it the pixel position and color cb(x, y, rgba)
  • if log is true it will print the image to the console

Example

var ezPixel = require('../index')(32)

ezPixel.map('demo/hat.png', (x, y, rgba) => {
  // do stuff with the pixel data
}, true)

License

MIT, see LICENSE.md for details.

About

License:MIT License


Languages

Language:JavaScript 100.0%