46

On Ubuntu 12.04 ImageMagick doesn't seem to support webp.

convert flyer.png flyer.webp

Creates a png file with webp extension.

On webp docs is stated that ImageMagick does support webp

$ convert --version`
Version: ImageMagick 6.6.9-7 2012-08-17 Q16

I have these both installed:

  • libwebp-dev - Lossy compression of digital photographic images.
  • libwebp2 - Lossy compression of digital photographic images.

Also, convert can't decode a webp file.

What's wrong, and is this an Ubuntu bug?

3
  • 1
    You can list supported formats with convert -list format. On my system, with the same convert version, webp doesn't appear.
    – chronitis
    Feb 6, 2013 at 12:13
  • 1
    Thx, I created a bugreport on Launchpad. Then it can be fixed for us all. bugs.launchpad.net/ubuntu/+source/imagemagick/+bug/1117481
    – Janghou
    Feb 6, 2013 at 16:42
  • This also affects debian 7 (wheezy), but they don't use launchpad for bugs.
    – earthmeLon
    Jun 29, 2014 at 4:39

4 Answers 4

46

Fixed in 16.04

In 16.04 convert flyer.png flyer.webp does work, although webp is needed:

sudo apt-get install webp

Without webp installed, this error message will show:

convert: delegate failed `"cwebp" -quiet -q %Q "%i" -o "%o"' @ error/delegate.c/InvokeDelegate/1310.
2
  • 1
    Unfortunately webp is not recognizable by ImageMagick 7.0.8-27 as a delegate, instead you have to install libwebp-dev
    – AbdelHady
    Feb 12, 2019 at 14:45
  • Thanks for this. Worked a treat on ImageMagick 6.9.10-14. Apr 20, 2020 at 22:13
23

The Ubuntu source package for imagemagick does not declare a build dependency on libwebp-dev. Thus imagemagick gets built without webp support. This could be considered a bug in Ubuntu.

Relevant output from the build process:

checking for WEBP... 
checking webp/decode.h usability... no
checking webp/decode.h presence... no
checking for webp/decode.h... no
checking for WebPDecodeRGB in -lwebp... no
checking if WEBP package is complete... no

And when libwebp-dev is installed:

checking for WEBP... 
checking webp/decode.h usability... yes
checking webp/decode.h presence... yes
checking for webp/decode.h... yes
checking for WebPDecodeRGB in -lwebp... yes
checking if WEBP package is complete... yes

If you want to fix this just for yourself, you can rebuild the package and install your version:

cd /tmp
mkdir imagemagick
cd imagemagick
sudo apt-get build-dep imagemagick
sudo apt-get install libwebp-dev devscripts
apt-get source imagemagick
cd imagemagick-*
debuild -uc -us
sudo dpkg -i ../*magick*.deb
1
20

In the mean time one can install:

$ sudo apt-get install webp

And use dwebp and cwebp commands to decompress/compress from/to webp file format.

2
  • 3
    This also allows imagemagick's idenfity to work properly with webp images. It fixes the following errors: identify: delegate failed "dwebp" -pam "%i" -o "%o"' @ error/delegate.c/InvokeDelegate/1310. identify: unable to open image /tmp/magick-510118LyrHZ5A5Sr': No such file or directory @ error/blob.c/OpenBlob/2712. identify: unable to open file `/tmp/magick-510118LyrHZ5A5Sr': No such file or directory @ error/constitute.c/ReadImage/540.
    – four43
    Aug 3, 2016 at 16:47
  • 2
    Unfortunately webp is not recognizable by ImageMagick 7.0.8-27 as a delegate, instead you have to install libwebp-dev
    – AbdelHady
    Feb 12, 2019 at 14:45
3

WebP support also has some issues with transparency before 6.8.3, so I've used 6.8.9-9 from 15.04 Vivid, and backported it to 14.04 Trusty with webp support. Use at your own risk:

sudo add-apt-repository ppa:jamedjo/ppa
sudo apt-get update
sudo apt-get install imagemagick libmagickcore-6.q16-2

In case you wish to repeat this, the steps were:

  • Using backportpackage imagemagick --source vivid --destination trusty --workdir=imagemagick-backport to fetch vivid's version and tar -xf to extract the .deb.
  • Then within debian/control replacing dpkg-dev (>= 1.17.6) dependency, adding dependencies for libwebp-dev and replacing Architecture: any with amd64 to avoid build failures.
  • Adding --with-webp in debian/rules, adding a changelog entry with dch and using debuild -S -sd to build a source only package.
  • Finally, set up an account on launchpad and follow their instructions to share your fix.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .