code: function renderImageToDataURL(img, blob, options, doSquash) {
          var canvas = document.createElement("canvas"),
              mime = options.mime || "image/jpeg",
              promise = new qq.Promise();
  
          renderImageToCanvas(img, blob, canvas, options, doSquash)
              .then(function() {
                  promise.success(
                      canvas.toDataURL(mime, options.quality || 0.8)
                  );
              });
  
          return promise;
      }
docs: Rendering image element (with resizing) and get its data URL