ImageMagick is great. It allows your web app to process, resize, filter, and do all kinds of other nifty things with images.
Not so long ago, ImageMagick 7 was released. One of the big new features was full support for WEBP images, the new image format from Google.
Now, you might think it’s easy to just upgrade to ImageMagick 7. If you’re using a linux OS like Ubuntu, you just apt install and you’re done, right?
As usual, we don’t get the latest and greatest packages – at least not in Ubuntu Server 18.04 LTS.
That means we need to install ImageMagick 7 from source.
And that usually means that something won’t work…
But fear not! Despite a severe lack of info on The Internets, I managed to get it to work:
Step 1: Uninstall your old ImageMagick by doing:
apt remove imagemagick imagemagick-6-common
Step 2: Just in case, install all the build dependencies for ImageMagick:
apt build-dep imagemagick
Step 3: Install image libraries, including WEBP:
apt-get install checkinstall libwebp-dev libopenjp2-7-dev librsvg2-dev libde265-dev
Step 4: Install ImageMagick (latest) from source:
wget https://www.imagemagick.org/download/ImageMagick.tar.gz tar xzvf ImageMagick.tar.gz
cd to the extracted directory, and then run:
./configure --enable-shared --with-modules --with-gslib make make install ldconfig /usr/local/lib identify -version
Ta-DA!!! You’re done!
Note that the ./configure stuff with the options above is very important. Otherwise, stuff won’t work.
Now you can move along and use ImageMagick 7, install RMagick 4.x in your rails app, or whatever…
What’s more, your app will now support the processing of WEBP images in ImageMagick!