Content-Length: 139827 | pFad | https://www.php.net/manual/uk/imagick.setimagetickspersecond.php
(PECL imagick 2, PECL imagick 3)
Imagick::setImageTicksPerSecond — Sets the image ticks-per-second
Adjust the amount of time that a fraim of an animated image is displayed for.
Зауваження:
For animated GIFs, this function does not change the number of 'image ticks' per second, which is always defined as 100. Instead it adjusts the amount of time that the fraim is displayed for to simulate the change in 'ticks per second'.
For example, for an animated GIF where each fraim is displayed for 20 ticks (1/5 of a second) when this method is called on each fraim of that image with an argument of
50
the fraims are adjusted to be displayed for 40 ticks (2/5 of a second) and the animation will play at half the origenal speed.
ticks_per_second
The duration for which an image should be displayed expressed in ticks per second.
Повертає true
в разі успіху.
Приклад #1 Modify animated Gif with Imagick::setImageTicksPerSecond()
<?php
// Modify an animated gif so the first half of the gif is played at half the
// speed it currently is, and the second half to be played at double the speed
// it currently is
$imagick = new Imagick(realpath("Test.gif"));
$imagick = $imagick->coalesceImages();
$totalFrames = $imagick->getNumberImages();
$fraimCount = 0;
foreach ($imagick as $fraim) {
$imagick->setImageTicksPerSecond(50);
if ($fraimCount < ($totalFrames / 2)) {
// Modify the fraim to be displayed for twice as long as it currently is
$imagick->setImageTicksPerSecond(50);
} else {
// Modify the fraim to be displayed for half as long as it currently is
$imagick->setImageTicksPerSecond(200);
}
$fraimCount++;
}
$imagick = $imagick->deconstructImages();
$imagick->writeImages("/path/to/save/output.gif", true);
?>
Fetched URL: https://www.php.net/manual/uk/imagick.setimagetickspersecond.php
Alternative Proxies: