code: function(opts) {
  				var defaults = {
  					width: this.width,
  					height: this.height,
  					crop: false,
  					preserveHeaders: true
  				};
  
  				if (typeof(opts) === 'object') {
  					opts = Basic.extend(defaults, opts);
  				} else {
  					opts = Basic.extend(defaults, {
  						width: arguments[0],
  						height: arguments[1],
  						crop: arguments[2],
  						preserveHeaders: arguments[3]
  					});
  				}
  
  				try {
  					if (!this.size) { // only preloaded image objects can be used as source
  						throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
  					}
  
  					// no way to reliably intercept the crash due to high resolution, so we simply avoid it
  					if (this.width > Image.MAX_RESIZE_WIDTH || this.height > Image.MAX_RESIZE_HEIGHT) {
  						throw new x.ImageError(x.ImageError.MAX_RESOLUTION_ERR);
  					}
  
  					this.getRuntime().exec.call(this, 'Image', 'downsize', opts.width, opts.height, opts.crop, opts.preserveHeaders);
  				} catch(ex) {
  					// for now simply trigger error event
  					this.trigger('error', ex.code);
  				}
  			}
docs: Downsizes the image to fit the specified width/height. If crop is supplied, image will be cropped to exact dimensions.
  
  @method downsize
  @param {Number} width Resulting width
  @param {Number} [height=width] Resulting height (optional, if not supplied will default to width)
  @param {Boolean} [crop=false] Whether to crop the image to exact dimensions
  @param {Boolean} [preserveHeaders=true] Whether to preserve meta headers (on JPEGs after resize)