       df.resolve(new Blob(newChunks, {type: blob.type}))
 
     df.promise()
+
+
+  ns.hasTransparency = (img) ->
+    pcsn = 50
+
+    canvas = document.createElement('canvas')
+    canvas.width = canvas.height = pcsn
+    ctx = canvas.getContext('2d')
+    ctx.drawImage(img, 0, 0, pcsn, pcsn)
+    data = ctx.getImageData(0, 0, pcsn, pcsn).data
+    canvas.width = canvas.height = 1
+
+    for i in [3...data.length] by 4
+      if data[i] < 254
+        return true
+
+    return false

        df.notify(.1)

        # start = new Date()
        img = new Image()
        img.onload = ->
          # console.log('load: ' + (new Date() - start))

          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
