node package manager
Loosely couple your services. Use Orgs to version and reuse your code. Create a free org »

get-center-pixel

get-center-pixel

given an array of pixel data not unlike that returned by canvasContext.getImageData().data and a width and a height, returns the data for the center pixel as {r: 0-255, g: 0-255, b: 0-255, a: 0-255}

NPM js-standard-style Build Status

EXAMPLE

  /// ... canvas/context setup code up here ... \\\\\\
  var width = canvas.width
  var height = canvas.height
  var pixels = ctx.getImageData(0, 0, width, height).data
  var getCenterPixel = require('get-center-pixel')
  getCenterPixel(pixels, widht, height)
  // => {r: 100, g: 212, b: 53, a: 183}
  // now do something with that pixel