32

How do I convert webp files to JPG format?

eebbesen
  • 4,946
  • 8
  • 48
  • 68
lmlmlm
  • 461
  • 1
  • 4
  • 7

1 Answers1

74

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
Mark Setchell
  • 169,892
  • 24
  • 238
  • 370
  • 4
    It does require that the webp and jpg delegates be installed with Imagemagick. See https://developers.google.com/speed/webp/download. You can see if it is installed using `convert -version` or `magick -version` as indicted by Mark above – fmw42 Mar 31 '18 at 21:52
  • 5
    In case you have many files: ```for i in *.webp; do name=`echo "$i" | cut -d'.' -f1`; echo "$name"; convert "$i" "${name}.jpg"; done``` – maaniB Mar 06 '21 at 16:31
  • 1
    @maaniB Actually there's a better way with `mogrify`, so I have updated my answer. – Mark Setchell Mar 06 '21 at 16:59
  • 1
    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"' _ {} \;` – ccpizza Apr 15 '22 at 11:22