Wednesday, June 17, 2026
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
32516 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6898 POSTS0 COMMENTS
Nicole Veronica
12014 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6964 POSTS0 COMMENTS