Python batch convert utility. Based on above contribution.
Requires creating a global webp-to-gif executable with Elder Geek's Sean Mahan code...
#!/usr/bin/env python3
# -*- coding: utf8 -*-
print( "####################################################" )
print( "Uses webp-to-gif to convert multiple..." )
print( "Converts all found if no regex provided " )
print( "args: [group regex: optional] [path: optional] " )
print( " " )
print( "####################################################" )
import sys, os, fnmatch, itertools
import re
args = [x.replace('\', '') for x in list(sys.argv)]; args.pop(0)
if len(args) == 1: args = args[0].split(' ')
print()
print()
print( "---------------------------------" )
print( " Begin... " )
print( "---------------------------------" )
print()
print()
regex = r'(.*).webp'
path = '.'
if len(args):
regex = args[0]
if len(args)>1:
path = args[1]
os.chdir(path)
nn = 0
for f in os.listdir('.'):
m = re.match(regex, f)
if m:
fn, e = os.path.splitext(f)
os.system('webp-to-gif %s %s' % (f, '%s.gif' % (fn)))
print( '- Done for "%s"' % f )
nn += 1
print()
print()
print( '---------------------------------' )
print( "%i matched" % nn )
print()
print()
print( "---------------------------------" )
print( " Done " )
print( "---------------------------------" )
print()
print()
convert image.webp test.gif. Does this work on your system? If this does not work straight up try the following:sudo apt-get install webpbefore repeating theconvert....command again... – andrew.46 Sep 04 '20 at 06:54convertcommand. i've triedsudo apt install convertand get the replypackage convert does not existwhat package is convert in? – rhubarbdog Sep 04 '20 at 10:31convertdoes not support webp, even with the webp package. – Cerin Oct 13 '20 at 20:36convertcommand works on 22.04. I'm pretty sure you need to installimagemagick-6.q16in addition toimagemagick-6-common(and also the webp package if that makes any difference). – mchid Mar 29 '25 at 18:13