PHP | Imagick removeImage() Function
Last Updated :
17 Dec, 2019
The Imagick::removeImage() function is an inbuilt function in PHP which is used to remove an image from the image list. This function removes the current image which is pointed by the cursor.
Syntax:
bool Imagick::removeImage( void )
Parameters: This function doesn’t accepts any parameters.
Return Value: This function returns TRUE on success.
Exceptions: This function throws ImagickException on error.
Below programs illustrate the Imagick::removeImage() function in PHP:
Program 1:
<?php
$imagick = new Imagick(
echo 'Number of images before removing: ' . $imagick -> count () . '<br>' ;
$imagick ->removeImage();
echo 'Number of images after removing: ' . $imagick -> count ();;
?>
|
Output:
Number of images before removing: 1
Number of images after removing: 0
Program 2:
<?php
$imagick = new Imagick(
$imagick ->addImage( new Imagick(
echo 'Number of images before removing: ' . $imagick -> count () . '<br>' ;
$imagick ->removeImage();
echo 'Number of images after removing: ' . $imagick -> count ();;
?>
|
Output:
Number of images before removing: 2
Number of images after removing: 1
Reference: https://www.php.net/manual/en/imagick.removeimage.php
Share your thoughts in the comments
Please Login to comment...