Needs work
Project:
ImageMagick
Version:
5.0.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
12 Jul 2022 at 09:19 UTC
Updated:
2 Oct 2026 at 19:35 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mondrakeYou’re probably hitting a limitation of Imagemagick itself here, see https://superuser.com/questions/1323522/how-can-i-convert-animated-gif-t...
Comment #3
internetter commentedYou can test if your ImageMagick server command works with webp-animations, just try
convert source.gif -coalesce target.gif.webpIn Image-Toolkit settings you can also look if ImageMagick is supporting webp:
/admin/config/media/image-toolkitthen open "image formats" and look for the supported formats under "FORMAT LIST".
But I found a code part at:
web/modules/contrib/imagemagick/src/Plugin/ImageToolkit/ImagemagickToolkit.php:797
So it is always using only the first frame of every animation. Perhaps I can make an patch to change this.
bye
Martin
Comment #4
internetter commentedPerhaps this would be a solution:
Comment #5
internetter commentedHere is it....
Comment #6
internetter commentedSourceformat is UpperCase. So this is better.
Comment #7
ravimalviya2000 commentedHello Team,
same issues i have found on my site also.is there any solution we have found for this issues.
Comment #8
dom. commentedRTBC for patch at #6.
Also, to get this to work, don't forget to activate the "-coalesce" option in the advanced settings (not really sure why this is not activated by default in the module?)
Comment #9
mondrakeI do not think this is the right way to address this. It would introduce a behaviour change vs current state where only the first frame is converted for animated GIFs. We might argue whether the current state is the right one or not, but no matter what we cannot simply change the behaviour like this.
I'd rather go a path similar to #2786435: Support '-coalesce' of Animated GIF image files where a configuration setting was introduced for the purpose. So each site owner to decide.
We also need tests.
Comment #10
vredko commentedthanks @internetter but patch#6 doesn't work for me.
i've created new patch. also checking "-coalesce" option which can be apply to gif and webp destination format.
Comment #15
trackleft2The patch from #10 works for me, I've create a merge request with the patch so we can continue work on this.
Changing to Needs work, because the maintainer said this needs tests.
Read more about https://usage.imagemagick.org/anim_basics/#coalesced on the imagemagick site.
Comment #16
trackleft2I've added a PHPUnit test
Comment #17
joegraduateManually triggered the "tests only" pipeline on the MR and saw that the new test added passes even without the other MR changes which I don't think is the expected result.
Spoke to @trackleft2 about this on Slack and he mentioned that he thinks he needs to add something to the test that verifies the generated file is still actually a multiframe image.
Comment #20
berdirI ported this to 5.x, but the changed part moved to a different place, which no longer seems to have access to getFrames(), so I wasn't sure how to handle it there and kept this part in the current location instead for now.
Comment #21
berdirI ported the MR to the 5.x branch, tests seem quite broken right now, apparently unrelated to this, but I manually tested it and it worked for my use case.
Comment #22
mondrakeRebuilt the MR by resetting to 5.0.x and reapplying the diff. There are legit PHPStan and test failures to fix. For PHPStan, it's enough to only target next major.
Comment #23
mondrake