PHP | ImagickPixelIterator getCurrentIteratorRow() function Last Updated : 02 Jan, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The ImagickPixelIterator::getCurrentIteratorRow() function is an inbuilt function in PHP which is used to get the current row as an array of ImagickPixel objects from the pixel iterator. Syntax: array ImagickPixelIterator::getCurrentIteratorRow( void ) Parameters:This function doesn’t accept any parameter. Return Value: This function returns an array value containing the ImagickPixel objects that can themselves be iterated. Exceptions: This function throws ImagickException on error. Below given programs illustrate the ImagickPixelIterator::getCurrentIteratorRow() function in PHP: Program 1 (Get first five pixels of first row): php <?php // Create a new imagick object $imagick = new Imagick(); // Create a image on imagick object with // 5 pixels on row and 10 pixels on columns $imagick->newImage(5, 10, 'black'); // Get the pixel iterator $pixelIterator = $imagick->getPixelIterator(); // Get the current iterator row $row = $pixelIterator->getCurrentIteratorRow(); print("<pre>".print_r($row, true)."</pre>"); ?> Output: Array ( [0] => ImagickPixel Object ( ) [1] => ImagickPixel Object ( ) [2] => ImagickPixel Object ( ) [3] => ImagickPixel Object ( ) [4] => ImagickPixel Object ( ) ) Program 2 (Get the color of first five pixels of first row): 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(); // Get the current iterator row $row = $pixelIterator->getCurrentIteratorRow(); echo "First five colors of pixels are:<br>"; print("Pixel 1:" . "<pre>".print_r($row[0]->getColor(), true)."</pre>"); print("Pixel 2:" . "<pre>".print_r($row[1]->getColor(), true)."</pre>"); print("Pixel 3:" . "<pre>".print_r($row[2]->getColor(), true)."</pre>"); print("Pixel 4:" . "<pre>".print_r($row[3]->getColor(), true)."</pre>"); print("Pixel 5:" . "<pre>".print_r($row[4]->getColor(), true)."</pre>"); ?> Output: First five colors of pixels are: Pixel 1: Array ( [r] => 255 [g] => 255 [b] => 255 [a] => 1 ) Pixel 2: Array ( [r] => 255 [g] => 255 [b] => 255 [a] => 1 ) Pixel 3: Array ( [r] => 255 [g] => 255 [b] => 255 [a] => 1 ) Pixel 4: Array ( [r] => 255 [g] => 255 [b] => 255 [a] => 1 ) Pixel 5: Array ( [r] => 255 [g] => 255 [b] => 255 [a] => 1 ) Reference: https://www.php.net/manual/en/imagickpixeliterator.getcurrentiteratorrow.php Comment More infoAdvertise with us Next Article PHP | Imagick getPixelRegionIterator() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | ImagickPixelIterator getIteratorRow() function The ImagickPixelIterator::getIteratorRow() function is an inbuilt function in PHP which is used to get the current pixel iterator row. This function is used to check in which row we are currently at while traversing the pixels of an image. Syntax: int ImagickPixelIterator::getIteratorRow( void ) Par 2 min read PHP | Imagick getPixelIterator() Function The Imagick::getPixelIterator() function is an inbuilt function in PHP which is used to return the image MagickPixelIterator. Syntax: ImagickPixelIterator Imagick::getPixelIterator( void ) Parameters:This function does not accept any parameter. Return Value: This function returns an ImagickPixelIter 1 min read PHP | ImagickPixelIterator __construct() function The ImagickPixelIterator::__construct() function is an inbuilt function in PHP which is used create a instance of ImagickPixelIterator object. This object is used to iterate through the pixels. Syntax: bool ImagickPixelIterator::__construct( Imagick $wand ) Parameters:This function accepts a single 2 min read PHP | Imagick getPixelRegionIterator() Function The Imagick::getPixelRegionIterator() function is an inbuilt function in PHP which is used to get an ImagickPixelIterator for an image section. Syntax: ImagickPixelIterator Imagick::getPixelRegionIterator( int $x, int $y, int $columns, int $rows ) Parameters:This function accepts four parameters as 2 min read PHP | ImagickPixel getIndex() function The ImagickPixel::getIndex() function is an inbuilt function in PHP which is used to get the colormap index of the pixel. Syntax: int ImagickPixel::getIndex( void ) Parameters:This function doesnât accept any parameter. Return Value: This function returns an integer value containing the index. Excep 2 min read PHP | Imagick getIteratorIndex() Function The Imagick::getIteratorIndex() function is an inbuilt function in PHP which is used to get the index of the current active image. This is a alternate for getImageIndex() function. Syntax: int Imagick::getIteratorIndex( void ) Parameters: This function doesnât accepts any parameter. Return Value: Th 1 min read Like