Skip to content

coleww/get-center-pixel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

💠 get the center pixel from some image data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published