       pixels[i+1] = pixels[i+1]*color.g/255
       pixels[i+2] = pixels[i+2]*color.b/255
     ctx.putImageData imageData, 0, 0
-    return new Captcha canvas, text+    return new Captcha canvas, text


module.exports =
  generate: (opt={}) ->
    {height,width,text} = opt
    height ?= 150
    width ?= 300
    text ?= (((1 + Math.random()) * 0x10000000) | 0).toString 32

    randomColor = -> Math.floor Math.random()*255
    colors = (r:randomColor(),g:randomColor(),b:randomColor() for num in [0..7])

    x = 5
    for letter, idx in text
      size = Math.floor(Math.random()*60)+50
      ctx.font = "#{size}px #{font}"
      ctx.textBaseline = "top"
      te = ctx.measureText letter
      y = Math.floor (((Math.random()*height-size)/100)+size/3)
