(PECL imagick 2.0.0)
Imagick::cropImage — Extrait une région d'une image
$width
, int $height
, int $x
, int $y
) : boolExtrait une région d'une image.
widthLa largeur du retaillage
heightLa hauteur du retaillage
xL'abscisse, coordonnée X, de la région retaillée, coin haut gauche
yL'ordonnée, coordonnée Y, de la région retaillée, coin haut gauche
Retourne TRUE en cas de succès.
Lance une exception ImagickException si une erreur survient.
Exemple #1 Exemple avec 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();
}
?>