 
   c.inPorts.add 'canvas',
     datatype: 'object'
+  c.inPorts.add 'step',
+    datatype: 'number'
   c.outPorts.add 'histogram',
     datatype: 'object'
   c.outPorts.add 'error',


  noflo.helpers.WirePattern c,
    in: ['canvas']
    out: ['histogram', 'error']
    forwardGroups: true
    async: true

  res.c[c] += 1
  do callback

computeHistogram = (data, res, step=defaultStep, callback) ->
  rgba = 4
  coutHistograms = 0
  step = if (data.length < (step * rgba)) or (step < 1) then 1 else step
  pixels = data.length / (rgba * step)
  last = data.length - step * rgba
  for index in [0...data.length] by step * rgba
    addEntryHistogram data, res, index, ->
      if index >= last
        # Normalize such that 1.0 means all pixels have this color
        for histogram of res
          normalize res[histogram], pixels, ->
