How can I avoid dropouts when using (imagemagick) `mogrify` to convert webp files to animated gif?
Asked Answered
G

1

5

Using this code mogrify -format gif *.webp that I found in another forum https://superuser.com/questions/1506337/batch-convert-webp-files-to-gif-files-offline/1506428 to convert a webp file, to an animated gif...

I was wondering if anyone else experienced patches of black and/or white "dropouts", when using this method? With many files, it works without incident, but with others, such as the attached, I have to use an online converter, to avoid this issue. Are there additional filters that I could apply, or other CLI methods for this type of conversion?

result with dropouts

Ginter answered 30/1, 2020 at 0:34 Comment(4)
What is your ImageMagick version and platform/OS? If IM 7 (HDRI), try adding -clamp to your command line.Pull
I'm using: Version: ImageMagick 6.9.10-83 Q16 x86_64 2020-01-10 imagemagick.org Copyright: © 1999-2020 ImageMagick Studio LLC on OSX 10.11.6Ginter
Can you post an input frame that looked normal after the conversion and an input frame that comes out with the white regions. Or better zip your input files and post to some free hosting service such as dropbox.com and put the URL here. Are you using the latest webp library?Pull
I don't have access to the files, so found a new one. In the zip file, is the original webp file, a version with dropouts, created with mogrify, a version from an online conversion with the same type of dropout results from ezgif, and 2 that converted properly from zamzar and convertio - dropbox.com/transfer/… I'm using the version listed above, which is the latest available on MacPorts.Ginter
P
7

Some of your webp frames have transparency and others do not. The fix seems to be to set the dispose method to none. So this works for me on IM 6.9.10.90 Q16 Mac OSX Sierra using convert. I suggest you use the more flexible convert rather than mogrify. I am not sure you can do what you want with mogrify as it wants one output per one input. Here is my command:

convert -delay 10 -dispose none tumblr_e573d6d767dd3d65d21de47fa7d16d13_4d26286c_400.webp -loop 0 animation.gif


or better

convert -delay 10 -dispose none tumblr_e573d6d767dd3d65d21de47fa7d16d13_4d26286c_400.webp -coalesce -loop 0 -layers optimize animation.gif


Give that a try and let me know if it works for you. The file is too large to upload directly. If you need to see it and my command does not work for you, then I will post it elsewhere and put a link here.

Pull answered 31/1, 2020 at 1:51 Comment(5)
Thanks for switching me over to convert. The mogrify command is simpler, but obviously wasn't the right way to go, at least not without some tweak that I couldn't find.Ginter
convert: data encoding scheme is not supported for imagemagick 7.0.8.68 , doesn't seem to work for animated imagesPyralid
As far as I know, ImageMagick does not support animated webp.Pull
Why -delay 10?Birthright
Sets the frame delay(about as low as you can) for animated gif output (from animated webp).Pull

© 2022 - 2024 — McMap. All rights reserved.