packages/plugin-normalize/src/index.js
function histogram() {
  const histogram = {
    r: new Array(256).fill(0),
    g: new Array(256).fill(0),
    b: new Array(256).fill(0)
  };

  this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
    x,
    y,
    index
  ) {
    histogram.r[this.bitmap.data[index + 0]]++;
    histogram.g[this.bitmap.data[index + 1]]++;
    histogram.b[this.bitmap.data[index + 2]]++;
  });

  return histogram;
}
function histogram() {
  const histogram = {
    r: new Array(256).fill(0),
    g: new Array(256).fill(0),
    b: new Array(256).fill(0)
  };

  this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
    x,
    y,
    index
  ) {
    histogram.r[this.bitmap.data[index + 0]]++;
    histogram.g[this.bitmap.data[index + 1]]++;
    histogram.b[this.bitmap.data[index + 2]]++;
  });

  return histogram;
}
function histogram ( ) { const histogram = { r : new Array ( 256 ) . fill ( 0 ) , g : new Array ( 256 ) . fill ( 0 ) , b : new Array ( 256 ) . fill ( 0 ) } ; this . scanQuiet ( 0 , 0 , this . bitmap . width , this . bitmap . height , function ( x , y , index ) { histogram . r [ this . bitmap . data [ index + 0 ] ] ++ ; histogram . g [ this . bitmap . data [ index + 1 ] ] ++ ; histogram . b [ this . bitmap . data [ index + 2 ] ] ++ ; } ) ; return histogram ; }
Get an image's histogram
@return {object} An object with an array of color occurrence counts for each channel (r,g,b)
Get an image s histogram