code: function toDataURL (image, options) {
    var src = '';
    var async, callback;
  
    options = options || {};
  
    async = typeof options.callback === 'function';
  
    callback = async ? options.callback : function (err, data) {
      if (err) {
        throw err;
      }
      return data;
    };
  
    function _convert (err, img) {
      if (err) {
        return callback(err);
      }
      var result;
      cors(img);
      result = convert(img, options.width, options.height);
      return callback(null, (options.purify ? purify(result) : result));
    }
  
    if (isImage(image)) {
      src = image.src || '';
    } else if (typeof image === 'string') {
      if (!async) {
        return callback(new Error('the url mode should be called with a callback'));
      }
      src = image;
    } else {
      return callback(new Error('image should be an Image Object or a string'));
    }
  
    return async ? createImage(src, _convert) : _convert(null, image);
  }
docs: toDataURL
  @param  {Image|String} image
  @param  {Object} options
  @return {null|String}
  
  Options:
  
  - `width` {Number=0}
  - `height` {Number=0}
  - `purify` {Boolean=false}
  - `callback` {Function}
  
  Callback:
  
  - `err`
  - `data`