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

Imagick::setImageIterations

PHP function Edit on GitHub ✎

(PECL imagick 2, PECL imagick 3)

Sets the image iterations

Description

Imagick::setImageIterations(int $iterations): bool

Sets the number of iterations an animated image is repeated.

Parameters

iterations

The number of iterations the image should loop over. Set to '0' to loop continuously.

Return Values

Success

Errors/Exceptions

Throws

Examples

Basic Imagick::setImageIterations() usage

php
<?php

$imagick = new Imagick(realpath("Test.gif"));

$imagick = $imagick->coalesceImages();
$imagick->setImageIterations(1);
$imagick = $imagick->deconstructImages();

$imagick->writeImages('/path/to/save/OnceOnly.gif', true);

?>

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