lib/url/imageurl.js
function(options) {
        options = options || {};

        if (!options.width || !options.height) {
            throw new Error('width and height must be specified');
        }

        var params = [
            'width=' + toInt(options.width),
            'height=' + toInt(options.height)
        ];

        if (options.mode) {
            params.push('mode=' + options.mode);
        }

        if (options.x) {
            params.push('x=' + toInt(options.x));
        }

        if (options.y) {
            params.push('y=' + toInt(options.y));
        }

        if (options.bg) {
            params.push('bg=' + options.bg.replace(/^#/, ''));
        }

        return this.append('canvas:' + params.join(','));
    }
function(options) {
        options = options || {};

        if (!options.width || !options.height) {
            throw new Error('width and height must be specified');
        }

        var params = [
            'width=' + toInt(options.width),
            'height=' + toInt(options.height)
        ];

        if (options.mode) {
            params.push('mode=' + options.mode);
        }

        if (options.x) {
            params.push('x=' + toInt(options.x));
        }

        if (options.y) {
            params.push('y=' + toInt(options.y));
        }

        if (options.bg) {
            params.push('bg=' + options.bg.replace(/^#/, ''));
        }

        return this.append('canvas:' + params.join(','));
    }
function ( options ) { options = options || { } ; if ( ! options . width || ! options . height ) { throw new Error ( 'width and height must be specified' ) ; } var params = [ 'width=' + toInt ( options . width ) , 'height=' + toInt ( options . height ) ] ; if ( options . mode ) { params . push ( 'mode=' + options . mode ) ; } if ( options . x ) { params . push ( 'x=' + toInt ( options . x ) ) ; } if ( options . y ) { params . push ( 'y=' + toInt ( options . y ) ) ; } if ( options . bg ) { params . push ( 'bg=' + options . bg . replace ( / ^# / , '' ) ) ; } return this . append ( 'canvas:' + params . join ( ',' ) ) ; }
Puts the image inside a canvas

@param  {Object} options
@param  {Number} options.width  Width of the canvas
@param  {Number} options.height Height of the canvas
@param  {String} [options.mode] Placement mode: "free", "center", "center-x" or "center-y"
@param  {Number} [options.x]    X coordinate of the placement of the upper left corner of the existing image
@param  {Number} [options.y]    Y coordinate of the placement of the upper left corner of the existing image
@param  {String} [options.bg]   Background color of the canvas, in hex-format
@return {Imbo.ImageUrl}
Puts the image inside a canvas