Imagick::extentImage


wizard apg

SETS the size of an image.



<?php

bool 
public Imagick::extentImage(
               
int $width,
               
int $height,
               
int $x,
               
int $y
                           
);

?>

$width


As a new Image width.



$height


As a new Image height.



$x


The X position for the new sise.



$y


The Y position for the new sise.





This function returns a TRUE on success.

Comfortability method for setting image size.

The method sets the image size and allows setting x,y coordinates where the new area begins.

This method is available if Imagick has been compiled against ImageMagick version 6.3.1 or newer.



  1 EXERCISE   

<?php

// Run several times

$imageo PATH2IMGW '/others/19a.jpg';
$imager 'img/results/19aext711.png';

$imagick = new Imagick($imageo);
$imagick->setImageBackgroundColor('cyan');
    
$imagick->extentImage(
$imagick->getImageWidth(),
$imagick->getImageHeight(), 100100);
    
$data $imagick->getImageBlob();
        
$img imagecreatefromstring($data);
    
imagejpeg($img$imager);

echo 
basename($imager); ?>
<br><br>
<img src="<?php echo $imager?>"
 alt="<?php echo $imager?>"
 title="<?php echo $imager?>">

 RESULT   

19aext711.png

Color = yellow
x = 58
y = -61

img/results/19aext711.png apr

Prague Astronomical Clock - Pražský orloj, Orloj - Praga (CZE)