PHP | Imagick setIteratorIndex() Function Last Updated : 28 Nov, 2019 Comments Improve Suggest changes Like Article Like Report The Imagick::setIteratorIndex() function is an inbuilt function in PHP which is used to set the image iterator position. This is an alternative for setImageIndex() function. Syntax: bool Imagick::setIteratorIndex( int $index ) Parameters: This function accepts a single parameter $index which holds the index. Return Value: This function returns TRUE on success. Exceptions: This function throws ImagickException on error. Below given programs illustrate the Imagick::setIteratorIndex() function in PHP: Program 1: php <?php // Create a new imagick object $imagick = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/20190918234528/colorize1.png'); // Add two more images in the same imagick object $imagick->addImage( new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png')); // Currently Cursor is at 1 // Set the Index to 0 $imagick->setIteratorIndex(0); // getImageBlob should show last added image but // cursor is set to 0 thus it shows first image header("Content-Type: image/png"); echo $imagick->getImageBlob(); ?> Output: Program 2: php <?php // Create a new imagick object $imagick = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png'); // Add two more images in the same imagick object $imagick->addImage( new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png')); $imagick->addImage( new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png')); // Currently Cursor is at 2 // Set the Index to 1 $imagick->setIteratorIndex(1); // Get the Index $index = $imagick->getIteratorIndex(); echo $index; ?> Output: 1 Reference: https://www.php.net/manual/en/imagick.setiteratorindex.php Comment More infoAdvertise with us Next Article PHP | Imagick setIteratorIndex() Function gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | Imagick setLastIterator() Function The Imagick::setLastIterator() function is an inbuilt function in PHP which is used to set the Imagick iterator to the last image. Syntax: bool Imagick::setLastIterator( void ) Parameters: This function doesnât accepts any parameter. Return Value: This function returns TRUE on success. Exceptions: T 2 min read PHP | Imagick setImageIndex() Function The Imagick::setImageIndex() function is an inbuilt function in PHP which is used to set the iterator position. Syntax: bool Imagick::setImageIndex( int $index ) Parameters: This function accepts a single parameter $index which holds the index. Return Value: This function returns TRUE on success. Ex 1 min read PHP | Imagick setFirstIterator() function The Imagick::setFirstIterator() function is an inbuilt function in PHP which is used to set the Imagick iterator to the first image. Syntax: bool Imagick::setFirstIterator( void ) Parameters: This function doesnât accept any parameter. Return Value: This function returns TRUE on success. Exceptions: 2 min read PHP | Imagick setImageIterations() Function The Imagick::setImageIterations() function is an inbuilt function in PHP which is used to set the image iterations. The iteration here actually means for how many times the frames should repeat themselves. Syntax: bool Imagick::setImageIterations( int $iterations ) Parameters: This function accepts 1 min read PHP | Imagick setImageProfile() Function The Imagick::setImageProfile() function is an inbuilt function in PHP which is used to set the named profile to the Imagick object. Syntax: bool Imagick::setImageProfile( string $name, string $profile ) Parameters:This function accepts two parameters as mentioned above and described below: $name: It 1 min read PHP | Imagick setOption() Function The Imagick::setOption() function is an inbuilt function in PHP which is used to set an option. Syntax: bool Imagick::setOption( string $key, string $value ) Parameters: This function accepts two parameters as mentioned above and described below: $key: It specifies the key for the option. $value: It 1 min read PHP | Imagick setFormat() Function The Imagick::setFormat() function is an inbuilt function in PHP which is used to set the format of the Imagick object. Syntax: bool Imagick::setFormat( string $format ) Parameters: This function accepts a single parameter $format which holds an string value. Return Value: This function returns TRUE 1 min read PHP | Imagick setImageFormat() Function The Imagick::setImageFormat() function is an inbuilt function in PHP which is used to set the format of a particular image in a sequence.Syntax:Â Â bool Imagick::setImageFormat( string $format ) Parameters: This function accepts a single parameter $format which holds a string value of the image forma 1 min read PHP | Imagick setPage() Function The Imagick::setPage() function is an inbuilt function in PHP which is used to set the page geometry of the Imagick object. Syntax: bool Imagick::setPage( int $width, int $height, int $x, int $y ) Parameters:This function accepts four parameters as mentioned above and described below: $width: It spe 2 min read PHP | Imagick setImagePage() Function The Imagick::setImagePage() function is an inbuilt function in PHP which is used to set the image page geometry. Syntax: bool Imagick::setImagePage(int $width, int $height, int $x, int $y ) Parameters: This function accepts four parameters as mentioned above and described below: $width: It specifies 1 min read Like