CLI command to convert Webp image(s) to JPG? [closed]
Asked Answered
C

1

72

How do I convert webp files to JPG format?

Cant answered 31/3, 2018 at 18:51 Comment(2)
I think the question is specific and therefore not too broad: it simply asks: How to convert webp to jpg. However superuser.com would be a better home for it, assuming that it is not a programming question.Orthostichy
In WIndows, open the .webp file in MS Paint and save as .jpg. :-)Nessie
F
165

Use ImageMagick v7:

magick input.webp output.jpg

Or ImageMagick v6:

convert input.webp output.jpg

If you have lots to do, use mogrify instead. So, say you want to convert all the WEBP images in the current directory to JPEG:

magick mogrify -format JPEG *.webp

And if you want the converted files in a directory called OUTPUT, use:

mkdir OUTPUT
magick mogrify -format JPEG -path OUTPUT *.webp
Forceps answered 31/3, 2018 at 21:28 Comment(8)
It does require that the webp and jpg delegates be installed with Imagemagick. See developers.google.com/speed/webp/download. You can see if it is installed using convert -version or magick -version as indicted by Mark aboveLocalism
In case you have many files: for i in *.webp; do name=`echo "$i" | cut -d'.' -f1`; echo "$name"; convert "$i" "${name}.jpg"; doneGnome
@Gnome Actually there's a better way with mogrify, so I have updated my answer.Forceps
Convert single file: ffmpeg -i myfile.webp myfile.jpg Convert all files from the current directory recursively: find . -iname '*.webp' -exec bash -c 'ffmpeg -y -i "$1" "${1%.*}.jpg"' _ {} \;Bik
I assume ImageMagick is cross platform. In any case, should we add "operating system" tags to the question, to try to get it reopened?Rann
For -path you may need to create the directory first.Rann
sudo apt install imagemagickButterbur
It worked only for PNG, not JPEG. Am I missing an extension or something?Meltwater

© 2022 - 2024 — McMap. All rights reserved.