110

I'm using ubuntu 12.04. I've installed libwebp2 & libwebp-dev

So far, no example found on the net of converting webp to jpg.

Some webp files can easily converted by using imagemagick with command

convert file.webp file.jpg

but lots of webp files cannot be converted and give error:

convert: no decode delegate for this image format `file.webp' @ error/constitute.c/ReadImage/532.
convert: missing an image filename `file.jpg' @ error/convert.c/ConvertImageCommand/3011.

--------added

This is the file: http://www.filedropper.com/file_144

Lesmana
  • 26,889
  • 20
  • 81
  • 86
apasajja
  • 1,917
  • 5
  • 17
  • 19

10 Answers10

148

Google already provided the tool to decode webp images in the libwebp package, your uploaded file works on Arch.

dwebp file.webp -o abc.png

For the encoding tool, check the cwebp command.

In Ubuntu you can install the tools with:

sudo apt install webp

On RHEL/CentOS:

 yum install libwebp libwebp-tools

And you might consider using this online tool.

Anthony Geoghegan
  • 12,605
  • 7
  • 59
  • 62
daisy
  • 53,527
  • 78
  • 236
  • 383
54

ffmpeg can do this. Useful if you already have ffmpeg. No need for installing other tools.

Simply:

ffmpeg -i file.webp out.png
xrisk
  • 691
  • 6
  • 8
28

Convert all webp files within a directory

find ./ -name "*.webp" -exec dwebp {} -o {}.png \;

Note: dwebp is in the libwebp package

HalosGhost
  • 4,732
  • 10
  • 33
  • 41
Jeff McHale
  • 381
  • 3
  • 2
  • 6
    For Ubuntu 16.04 I needed to install it with `sudo apt-get install webp`. – PhoneixS Aug 18 '17 at 17:58
  • Dont know if ment as a feature or a bug, but all the files will be saved as `file.webpg.png` instead of simply `file.png` – mrfr Jul 09 '19 at 20:35
  • It's a feature for simplicity... I have a image hashing algorithm which automatically renames images, so I intended to rename the files using that. – Jeff McHale Jul 11 '19 at 01:00
  • Using ffmpeg: `find ./ -name "*.webp" -exec ffmpeg -i {} {}.jpeg \;` – Kyle Chadha Feb 13 '21 at 19:39
11

From the directory containing the webp files:

for x in *.webp; do ffmpeg -i "$x" "${x%.webp}.jpg"; done
Kev
  • 1,729
  • 4
  • 27
  • 47
Byram Sewell
  • 111
  • 1
  • 2
3

Use dwebp for webp->png, and then convert for png->jpg. Using pipe.

dwebp 1.webp -o - | convert - 1.jpg
steve
  • 21,582
  • 5
  • 48
  • 75
1

There is another online tool available here which can help you on this:

but if you want a local tool, you can use this one:

and use it like this:

1) chmod a+x webpconv

2) ./webpconv -format PNG <YOUR_WEBP_FILE>.webp

The overall structure is like this:

webpconv [-output_dir dir] [-format format] [-quality quality] input_file(s)

Example) To convert a .png image to WebP with a quality of 90 you would enter:

webpconv -quality 90 /home/user/image_name.png

and to convert a WebP file to a PNG one:

webpconv -format PNG /home/user/image_name.webp

Hojat Taheri
  • 5,026
  • 6
  • 23
  • 22
0

To convert multiple jpg to webp, using cwebp:

find ./ -name "*.jpg" -exec cwebp -q 70 {} -o {}.webp \

Thunar Custom Action:

for file in %F; do cwebp "$file" -o "${file%%.*}".webp; done

Thunar Custom Action, moving webp images to subfolder:

mkdir %d/webp && cd %d; for file in %N; do cwebp "$file" -o "webp/${file%%.*}".webp; done

Cwebp's default quality setting is 75.

whitewings
  • 2,377
  • 7
  • 32
  • 53
0

install the webp package with sudo apt install webp, after that it should work.

törzsmókus
  • 184
  • 1
  • 9
0

for x in ls *.webp; do ffmpeg -i $x ${x%.webp}.jpg; done which is solution stolen from Byram Sewell and Jeff Bowman https://stackoverflow.com/a/17844019/146745

andrej
  • 171
  • 4
-1

I found this method faster for my 1 time need.

  1. Take screenshot with webp image open in chrome.
  2. Paste into paint program.
  3. Crop and save.
Ramesh
  • 38,687
  • 43
  • 140
  • 215
PRS
  • 15
  • 1