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 returns TRUE on success.

Below programs illustrate the ImagickPixelIterator::setIteratorLastRow() function in PHP:



Program 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
  
// Create a new imagick object
$imagick = new Imagick(
     
// Get the pixel iterator
$pixelIterator = $imagick->getPixelIterator();
  
// Get the current iterator row
echo "Current row is " . $pixelIterator->getIteratorRow();
    
// Set the iterator to last row
$pixelIterator->setIteratorLastRow();
    
// Get the current iterator row
echo "<br>Current row is " . $pixelIterator->getIteratorRow();
?>

chevron_right


Output:

Current row is 0
Current row is 183

Program 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
  
// Create a new imagick object
$imagick = new Imagick();
  
// Create a image on imagick object
$imagick->newImage(800, 250, 'black');
  
// Get the pixel iterator
$pixelIterator = $imagick->getPixelIterator();
  
// Set the iterator to last row
$pixelIterator->setIteratorLastRow();
  
$row = $pixelIterator->getIteratorRow() + 1;
echo "<br>Total number of rows in image is " . $row;
?>

chevron_right


Output:

Total number of rows in image is 250

Reference: https://www.php.net/manual/en/imagickpixeliterator.setiteratorlastrow.php




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.