0.0.2 • Published 8 years ago

pixelbank v0.0.2

Weekly downloads
4
License
ISC
Repository
github
Last release
8 years ago

PixelBank

Parser for ImageData

Usage

var parse = require("pixelbank")

parse(imageData)
// =>
// [
//   { top: 0, left: 0, color: { r: 255, g: 13, b: 0, a: 255 } },
//   { top: 0, left: 1, color: { r: 0, g: 255, b: 0, a: 255 } },
//   ...
// ]

or

var PixelBank = require("pixelbank").PixelBank
var pixelBank = new PixelBank(imageData)
pixelBank.parse()

If you use ES2016 module

import parse, { PixelBank } from "pixelbank"
let pixelBank = new PixelBank(imageData)
pixelBank.parse()
// or
parse(imageData)

API

parse(imageData)

Parse imageData.

Uint8ClampedArray is converted like this

{
  top: 10,  // pixel Y position. (0 ~ height)
  left: 20, // pixel X position. (0 ~ width)
  color: {
    r: 30, // red   0 ~ 255
    g: 40, // green 0 ~ 255
    b: 50, // blue  0 ~ 255
    a: 60  // alpha 0 ~ 255
  }
}