public function crop($w, $h, $x, $y)
	{
		if ( $this->test() ){
			$args = \func_get_args();
			foreach ( $args as $arg ){
				if ( !is_numeric($arg) ){
					$this->error = \defined('BBN_ARGUMENTS_MUST_BE_NUMERIC') ?
						BBN_ARGUMENTS_MUST_BE_NUMERIC : 'Arguments must be numeric';
				}
			}
			if ( $w + $x > $this->w ){
				return false;
			}
			if ( $h + $y > $this->h ){
				return false;
			}
			if ( class_exists('\\Imagick') ){
				if ( !$this->img->cropImage($w,$h,$x,$y) ){
					$this->error = \defined('BBN_THERE_HAS_BEEN_A_PROBLEM') ?
						BBN_THERE_HAS_BEEN_A_PROBLEM : 'There has been a problem';
				}
			}
			else
			{
				$img = imagecreatetruecolor($w,$h);
        if ( $this->ext == 'png' || $this->ext == 'gif' || $this->ext == 'svg' ){
          imageColorAllocateAlpha($img, 0, 0, 0, 127);
          imagealphablending($img, false);
          imagesavealpha($img, true);
        }
				if ( imagecopyresampled($img,$this->img,0,0,$x,$y,$w,$h,$w,$h) ){
					$this->img = $img;
				}
				else{
					$this->error = \defined('BBN_THERE_HAS_BEEN_A_PROBLEM') ?
						BBN_THERE_HAS_BEEN_A_PROBLEM : 'There has been a problem';
				}
			}
		}
		return $this;
	}
public function crop($w, $h, $x, $y)
	{
		if ( $this->test() ){
			$args = \func_get_args();
			foreach ( $args as $arg ){
				if ( !is_numeric($arg) ){
					$this->error = \defined('BBN_ARGUMENTS_MUST_BE_NUMERIC') ?
						BBN_ARGUMENTS_MUST_BE_NUMERIC : 'Arguments must be numeric';
				}
			}
			if ( $w + $x > $this->w ){
				return false;
			}
			if ( $h + $y > $this->h ){
				return false;
			}
			if ( class_exists('\\Imagick') ){
				if ( !$this->img->cropImage($w,$h,$x,$y) ){
					$this->error = \defined('BBN_THERE_HAS_BEEN_A_PROBLEM') ?
						BBN_THERE_HAS_BEEN_A_PROBLEM : 'There has been a problem';
				}
			}
			else
			{
				$img = imagecreatetruecolor($w,$h);
        if ( $this->ext == 'png' || $this->ext == 'gif' || $this->ext == 'svg' ){
          imageColorAllocateAlpha($img, 0, 0, 0, 127);
          imagealphablending($img, false);
          imagesavealpha($img, true);
        }
				if ( imagecopyresampled($img,$this->img,0,0,$x,$y,$w,$h,$w,$h) ){
					$this->img = $img;
				}
				else{
					$this->error = \defined('BBN_THERE_HAS_BEEN_A_PROBLEM') ?
						BBN_THERE_HAS_BEEN_A_PROBLEM : 'There has been a problem';
				}
			}
		}
		return $this;
	}
public function crop ( $ w , $ h , $ x , $ y ) { if ( $ this -> test ( ) ) { $ args = \ func_get_args ( ) ; foreach ( $ args as $ arg ) { if ( ! is_numeric ( $ arg ) ) { $ this -> error = \ defined ( 'BBN_ARGUMENTS_MUST_BE_NUMERIC' ) ? BBN_ARGUMENTS_MUST_BE_NUMERIC : 'Arguments must be numeric' ; } } if ( $ w + $ x > $ this -> w ) { return false ; } if ( $ h + $ y > $ this -> h ) { return false ; } if ( class_exists ( '\\Imagick' ) ) { if ( ! $ this -> img -> cropImage ( $ w , $ h , $ x , $ y ) ) { $ this -> error = \ defined ( 'BBN_THERE_HAS_BEEN_A_PROBLEM' ) ? BBN_THERE_HAS_BEEN_A_PROBLEM : 'There has been a problem' ; } } else { $ img = imagecreatetruecolor ( $ w , $ h ) ; if ( $ this -> ext == 'png' || $ this -> ext == 'gif' || $ this -> ext == 'svg' ) { imageColorAllocateAlpha ( $ img , 0 , 0 , 0 , 127 ) ; imagealphablending ( $ img , false ) ; imagesavealpha ( $ img , true ) ; } if ( imagecopyresampled ( $ img , $ this -> img , 0 , 0 , $ x , $ y , $ w , $ h , $ w , $ h ) ) { $ this -> img = $ img ; } else { $ this -> error = \ defined ( 'BBN_THERE_HAS_BEEN_A_PROBLEM' ) ? BBN_THERE_HAS_BEEN_A_PROBLEM : 'There has been a problem' ; } } } return $ this ; }
Returns a crop of the image.

```php
$img = new bbn\file\image("/home/data/test/image.jpg");
bbn\x::dump($img->get_width(),$img->get_height());
// (int) 345  146
$img->crop(10, 10, 30, 30)->save("/home/data/test/img2.jpeg");
$img2 = new \bbn\file\image("/home/data/test/img2.jpeg");
bbn\x::hdump($img2->get_width(),$img2->get_height());
// (int) 10  10
```

@param integer $w the new width
@param integer $h the new height
@param integer $x X coordinate
@param integer $y Y coordinate
@return image|false
Returns a crop of the image .