PHP | ImagickPixelIterator setIteratorFirstRow() Function Last Updated : 14 Jan, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The ImagickPixelIterator::setIteratorFirstRow() function is an inbuilt function in PHP which is used to set the pixel iterator to the first pixel row. Syntax: bool ImagickPixelIterator::setIteratorFirstRow( void ) Parameters: This function doesn’t accepts any parameter. Return Value: This function returns TRUE on success. Below programs illustrate the ImagickPixelIterator::setIteratorFirstRow() 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'); // Get the pixel iterator $pixelIterator = $imagick->getPixelIterator(); // Set the pixel iterator to 50 $pixelIterator->setIteratorRow(50); // Get the current iterator row echo "Current row is " . $pixelIterator->getIteratorRow(); // Set the iterator to first row $pixelIterator->setIteratorFirstRow(); // Get the current iterator row echo "<br>Current row is " . $pixelIterator->getIteratorRow(); ?> Output: Current row is 50 Current row is 0 Program 2: php <?php // Create a new imagick object $imagick = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png'); // Get the pixel iterator $pixelIterator = $imagick->getPixelIterator(); $pixelIterator->setIteratorRow(40); // Get the current iterator row $row = $pixelIterator->getCurrentIteratorRow(); echo "Colors of 61th and 62nd pixel from 40th row are:<br>"; print("Pixel 60:" . "<pre>".print_r($row[60]->getColor(), true)."</pre>"); print("Pixel 61:" . "<pre>".print_r($row[61]->getColor(), true)."</pre>"); // Set the iterator to first row $pixelIterator->setIteratorFirstRow(); // Get the current iterator row $row = $pixelIterator->getCurrentIteratorRow(); echo "First two colors of pixels from first row are:<br>"; print("Pixel 1:" . "<pre>".print_r($row[0]->getColor(), true)."</pre>"); print("Pixel 2:" . "<pre>".print_r($row[1]->getColor(), true)."</pre>"); ?> Output: Colors of 61th and 62nd pixel from 40th row are: Pixel 60: Array ( [r] => 110 [g] => 199 [b] => 131 [a] => 1 ) Pixel 61: Array ( [r] => 23 [g] => 165 [b] => 57 [a] => 1 ) First two colors of pixels from first row are: Pixel 1: Array ( [r] => 255 [g] => 255 [b] => 255 [a] => 1 ) Pixel 2: Array ( [r] => 255 [g] => 255 [b] => 255 [a] => 1 ) Reference: https://www.php.net/manual/en/imagickpixeliterator.setiteratorfirstrow.php Comment More infoAdvertise with us Next Article PHP | ImagickPixelIterator setIteratorFirstRow() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | ImagickPixelIterator setIteratorRow() function The ImagickPixelIterator::setIteratorRow() function is an inbuilt function in PHP which is used to set the pixel iterator row. This function is used to move to any row in the current image pixels. Syntax: bool ImagickPixelIterator::setIteratorRow( int $row ) Parameters:This function accepts a single 2 min read PHP | ImagickPixelIterator setIteratorLastRow() Function The ImagickPixelIterator::setIteratorLastRow() function is an inbuilt function in PHP which is used to set the pixel iterator to the last pixel row. Syntax: bool ImagickPixelIterator::setIteratorLastRow( void ) Parameters: This function doesnât accepts any parameters. Return Value: This function ret 1 min read PHP | ImagickPixelIterator resetIterator() Function The ImagickPixelIterator::resetIterator() function is an inbuilt function in PHP which is used to reset the pixel iterator. Syntax: bool ImagickPixelIterator::resetIterator( void ) Parameters:This function doesnât accepts any parameter. Return Value: This function returns TRUE on success. Below prog 2 min read PHP | ImagickPixelIterator syncIterator() Function The ImagickPixelIterator::syncIterator() function is an inbuilt function in PHP which is used to sync the pixel iterator. Syntax: bool ImagickPixelIterator::syncIterator( void ) Parameters:This function doesnât accepts any parameter. Return Value: This function returns TRUE on success. Exceptions: T 2 min read PHP | Imagick setIteratorIndex() Function 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 t 1 min read Like