Friday, November 14, 2025
HomeLanguagesPHP | Imagick getImageDelay() Function

PHP | Imagick getImageDelay() Function

The Imagick::getImageDelay() function is an inbuilt function in PHP which is used to get the image delay. The delay is actually the time taken for transition from one image to another in a gif animation.

Syntax:

int Imagick::getImageDelay( void )

Parameters: This function doesn’t accepts any parameter.

Return Value: This function returns an integer value which contains the image delay in centiseconds(100centi = 1sec).

Exceptions: This function throws ImagickException on error.

Below programs illustrates the Imagick::getImageDelay() function in PHP:

Program 1:




<?php
  
// Create a new imagick object
$imagickAnimation = new Imagick(
  
foreach ($imagickAnimation as $frame) {
    $delay = $frame->getImageDelay();
    echo $delay . '<br>';
}
  
?>


Output:

100
100  // Which means that image changes after every 1 second.

Program 2:




<?php
  
// Create a new imagick object
$imagickAnimation = new Imagick(
  
foreach ($imagickAnimation as $frame) {
    $delay = $frame->getImageDelay();
    echo $delay . '<br>';
}
?>


Output:

50
50  // Which means that image changes after every 0.5 second.

Reference: https://www.php.net/manual/en/imagick.getimagedelay.php

RELATED ARTICLES

Most Popular

Dominic
32399 POSTS0 COMMENTS
Milvus
95 POSTS0 COMMENTS
Nango Kala
6765 POSTS0 COMMENTS
Nicole Veronica
11917 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11984 POSTS0 COMMENTS
Shaida Kate Naidoo
6889 POSTS0 COMMENTS
Ted Musemwa
7142 POSTS0 COMMENTS
Thapelo Manthata
6837 POSTS0 COMMENTS
Umr Jansen
6840 POSTS0 COMMENTS