php8.5
Home/ Manual/ imagick / imagick/ Imagick::getIteratorIndex

Imagick::getIteratorIndex

PHP function Edit on GitHub ✎

(PECL imagick 2, PECL imagick 3)

Gets the index of the current active image

Description

Imagick::getIteratorIndex(): int

Returns the index of the current active image within the Imagick object. 0x629

Parameters Parameters

Return Values

Returns an integer containing the index of the image in the stack.

Errors/Exceptions

Throws

Examples

Using Imagick::getIteratorIndex():

Create images, set and get the iterator index

php
<?php
$im = new Imagick();
$im->newImage(100, 100, new ImagickPixel("red"));
$im->newImage(100, 100, new ImagickPixel("green"));
$im->newImage(100, 100, new ImagickPixel("blue"));

$im->setIteratorIndex(1);
echo $im->getIteratorIndex();
?>

See Also

Source: reference/imagick/imagick/getiteratorindex.xml · from the official PHP manual (php/doc-en)