HomeLanguagesPHP | Imagick setImageTicksPerSecond() Function

PHP | Imagick setImageTicksPerSecond() Function

The Imagick::setImageTicksPerSecond() function is an inbuilt function in PHP which is used to set the image ticks-per-second which means the amount of time that a frame of an animated image is displayed.

Syntax:

bool Imagick::setImageTicksPerSecond( int $ticks_per_second )

Parameters: This function accepts a single parameter $ticks_per_second which holds the duration for which an image should be displayed expressed in ticks per second.

Return Value: This function returns TRUE on success.

Exceptions: This function throws ImagickException on error.

Below programs illustrate the Imagick::setImageTicksPerSecond() function in PHP:

Program 1:




<?php
  
// Create a new imagick object
$imagickAnimation = new Imagick(
  
// Set the image ticks per second
$imagickAnimation->setImageTicksPerSecond(800);
  
// Display the image
header("Content-Type: image/gif");
echo $imagickAnimation->getImagesBlob();
?>


Output:

Program 2:




<?php
  
// Create a new imagick object
$imagickAnimation = new Imagick(
  
// Set the image ticks per second
$imagickAnimation->setImageTicksPerSecond(2000);
  
// Display the image
header("Content-Type: image/gif");
echo $imagickAnimation->getImagesBlob();
?>


Output:

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

RELATED ARTICLES

Most Popular

Dominic
32705 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
7076 POSTS0 COMMENTS
Nicole Veronica
12212 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12303 POSTS0 COMMENTS
Shaida Kate Naidoo
7198 POSTS0 COMMENTS
Ted Musemwa
7457 POSTS0 COMMENTS
Thapelo Manthata
7175 POSTS0 COMMENTS
Umr Jansen
7162 POSTS0 COMMENTS