index.js
function (x, y, width, height) {

		var image;

		width = Math.min(width, this.getWidth() - x);
		height = Math.min(height, this.getHeight() - y);

		if ((width < 0) || (height < 0)) {
			throw new Error('Width and height cannot be negative.');
		}

		image = new PNG({
			width: width, height: height
		});

		this._image.bitblt(image, x, y, width, height, 0, 0);
		this._image = image;
	}
function (x, y, width, height) {

		var image;

		width = Math.min(width, this.getWidth() - x);
		height = Math.min(height, this.getHeight() - y);

		if ((width < 0) || (height < 0)) {
			throw new Error('Width and height cannot be negative.');
		}

		image = new PNG({
			width: width, height: height
		});

		this._image.bitblt(image, x, y, width, height, 0, 0);
		this._image = image;
	}
function ( x , y , width , height ) { var image ; width = Math . min ( width , this . getWidth ( ) - x ) ; height = Math . min ( height , this . getHeight ( ) - y ) ; if ( ( width < 0 ) || ( height < 0 ) ) { throw new Error ( 'Width and height cannot be negative.' ) ; } image = new PNG ( { width : width , height : height } ) ; this . _image . bitblt ( image , x , y , width , height , 0 , 0 ) ; this . _image = image ; }
Clips the current image by modifying it in-place

@method clip
@param {int} x Starting x-coordinate
@param {int} y Starting y-coordinate
@param {int} width Width of area relative to starting coordinate
@param {int} height Height of area relative to starting coordinate
Clips the current image by modifying it in - place