PHP | Imagick previousImage() Function Last Updated : 04 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The Imagick::previousImage() function is an inbuilt function in PHP which is used to move to the previous image within the Imagick instance. An Imagick instance may consist of a list of images within it and Imagick previousImage() moves the pointer/cursor to the previous image in the image list within an Imagick instance. Syntax: bool Imagick::previousImage( void ) Parameters: This function doesn’t accepts any parameter. Return Value: This function returns TRUE on success. Exceptions: This function throws ImagickException on error. Below given programs illustrate the Imagick::previousImage() function in PHP: Program 1: php <?php // Create a new imagick object $imagick = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png'); // Add a image to the imagick object. $imagick->addImage(new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/20190918234528/colorize1.png')); // Get the index $index1 = $imagick->getIteratorIndex(); echo 'Before: ' . $index1 . '<br>'; // Move the cursor to first image $imagick->previousImage(); $imagick->previousImage(); // Get the index $index2 = $imagick->getIteratorIndex(); echo 'After: ' . $index2 . '<br>'; ?> Output: Before: 1 After: 0 Program 2: php <?php // Create a new imagick object $imagick = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/20190918234528/colorize1.png'); // Add a image to the imagick object. $imagick->addImage(new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png')); // Move the cursor to first image $imagick->previousImage(); $imagick->previousImage(); // Display the image header("Content-Type: image/png"); echo $imagick->getImageBlob(); ?> Output: Reference: https://www.php.net/manual/en/imagick.previousimage.php Comment More infoAdvertise with us Next Article PHP | Imagick removeImage() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | Imagick previewImages() Function The Imagick::previewImages() function is an inbuilt function in PHP which is used to quickly pin-point appropriate parameters for image processing. It tiles 9 thumbnails of the specified image with an image processing operation applied at varying strengths. Syntax: bool Imagick::previewImages( int 1 min read PHP | Imagick readImage() Function The Imagick::readImage() function is an inbuilt function in PHP which is used to read an image from filename. Syntax: bool Imagick::readImage( string $filename ) Parameters:This function accepts a single parameter $filename which holds the name of the file. It can also accept URL of the file. Return 1 min read PHP | Imagick removeImage() Function 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 V 1 min read PHP | Imagick rollImage() Function The Imagick::rollImage() function is an inbuilt function in PHP which is used to roll an image. Syntax: bool Imagick::rollImage( $x, $y ) Parameters: This function accepts two parameters as mentioned above and described below: $x: This parameter stores the value of the X offset. $y: This parameter s 1 min read PHP | Imagick resizeImage() Function The Imagick::resizeImage() function is an inbuilt function in PHP which is used to scale an image to the desired dimensions. Syntax: bool Imagick::resizeImage( int $columns, int $rows, int $filter, float $blur, bool $best_fit = false, bool $legacy = false ) Parameters: This function accepts six para 2 min read PHP | Imagick readImages() Function The Imagick::readImages() function is an inbuilt function in PHP which is used to read images from an array of filenames and associate them to a single Imagick object. Syntax: bool Imagick::readImages( array $filenames ) Parameters:This function accepts a single parameter $filenames which holds an a 2 min read Like