Closed olivervogel closed 2 months ago
This feature is available from version 3.7.0.
As of this version, it is possible to configure the ImageManager globally. The decodeAnimation option can be used to prevent animations from being read out in the decoding process.
use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Imagick\Driver;
// disable animation decoding in config
$manager = new ImageManager(
Driver::class,
decodeAnimation: false,
);
// animated gif is only read with the first frame
$image = $manager->read('animation.gif');
Describe the feature you'd like
Intervention Image 2 did not support animated GIFs. Animated images were reable, but only the first frame was processed and the rest was discarded.
Of course, this meant that the animation was lost, but in the end it also saved resources. This is particularly noticeable when using the GD driver, as animated GIFs are not natively supported here and an individual
GDImage
instance must be created in memory for each frame.If you read in images without the intention of processing the animation anyway, this process is carried out for nothing. It is of course possible to discard the animation with removeAnimation() afterwards, but then the decoding process has already been carried out.
For this reason, there should be a way to ignore the animation directly during or before decoding and not even start this resource-intensive process.
Is your feature request related to a problem? Please describe.
See #1305