       canvas.getContext('2d').drawImage(img, 0, 0, sW, sH)
       img = canvas
 
-    # console.log('draw: ' + (new Date() - start))
-    df.resolve(canvas)
+      df.notify((originalW - sW) / (originalW - w))
+      setTimeout(run, 0)
 
     df.promise()
 

    x = 1.4
    maxSquare = 5000000  # ios max canvas square
    maxSize = 4096 # ie max canvas dimensions
    while sW > w
      sW = Math.round(sW / x)
      sH = Math.round(sH / x)
      if sW < w * x

      img.onload = ->
        # console.log('load: ' + (new Date() - start))
        op = ns.reduceImage(img, settings)
        op.progress (progress) ->
          console.log(progress)
        op.fail df.reject
        op.done (canvas) ->
          # start = new Date()
