update : 2015.11.03
php.shukuma.com

검색:
 
 
Extracts a region of the image

Imagick::cropImage

(PECL imagick 2.0.0)

Imagick::cropImageExtracts a region of the image

설명

bool Imagick::cropImage ( int $width , int $height , int $x , int $y )

Extracts a region of the image.

인수

width

The width of the crop

height

The height of the crop

x

The X coordinate of the cropped region's top left corner

y

The Y coordinate of the cropped region's top left corner

반환값

성공시에 TRUE를 반환합니다.

오류/예외

오류시에 ImagickException이 발생합니다.

예제

Example #1 Imagick::cropImage()

<?php
function cropImage($imagePath$startX$startY$width$height) {
    
$imagick = new \Imagick(realpath($imagePath));
    
$imagick->cropImage($width$height$startX$startY);
    
header("Content-Type: image/jpg");
    echo 
$imagick->getImageBlob();
}

?>