         df.notify(.1)
 
         # start = new Date()
+        isJPEG = op.state() is 'resolved'
         img = new Image()
         img.onload = ->
           # console.log('load: ' + (new Date() - start))

      df.resolve(new Blob(newChunks, {type: blob.type}))

    df.promise()

          op.fail(df.reject, release)
          op.done (canvas) ->
            # start = new Date()
            format = 'image/jpeg'
            quality = settings.quality or 0.8
            if not isJPEG and ns.hasTransparency(canvas)
              format = 'image/png'
              quality = undefined
            utils.canvasToBlob canvas, format, quality,
              (blob) ->
                canvas.width = 1
                canvas.height = 1
