Install ImageMagick on Ubuntu 22.04 or 20.04
If you’ve ever tried converting a PDF to PNG with convert and hit a wall, this guide will get you past that and back into the image‑editing groove. I’ll walk through the quickest ways to install the latest stable build of ImageMagick, what to do when the default Ubuntu package feels like it’s stuck in 2015, and how to make sure all the optional magic happens right.
Why the stock Ubuntu repo is a bit sluggish
If you only need basic conversions, the repo build will suffice. But if you want the newest features or better performance, grab the official binaries from ImageMagick’s site or a PPA.
Quick & dirty: install the Ubuntu‑repo package
sudo apt update sudo apt install imagemagick
That does it. To check the installed version:
magick -version
You’ll see something like ImageMagick 6.9.x, which is fine for everyday scripts but not for cutting‑edge filters.
Upgrade to ImageMagick 7 with a PPA
The easiest way to get the newer release without messing around with source compilation is to add the ppa:imagemagick-dev/stable PPA:
sudo add-apt-repository ppa:imagemagick-dev/stable sudo apt update sudo apt install imagemagick
This replaces the old binary with the 7.x build and gives you the new magick command. Now run:
magick -version
You should see something like ImageMagick 7.0.x.
Compile from source for ultimate control
If you’re a power user who likes to tweak compile flags or need a version that isn’t yet in the PPA, pulling it straight from GitHub is worth it.
sudo apt install build-essential libjpeg-dev libpng-dev libtiff-dev libgif-dev git clone https://github.com/ImageMagick/ImageMagick.git cd ImageMagick ./configure --disable-dependency-tracking make -j$(nproc) sudo make install
The --disable-dependency-tracking flag speeds up the build, and -j$(nproc) tells make to use all CPU cores. After installation, run magick -version again to verify.
Optional: Enable Ghostscript for PDF support
Many folks hit an “no Xpdf support” error when converting PDFs. Installing Ghostscript resolves that:
sudo apt install ghostscript
Then try:
magick input.pdf page-%d.png
and you’ll get a series of PNGs, one per PDF page.
Common gotchas
- Conflicting binaries – If both convert and magick are on your path, the older convert may still be from ImageMagick 6. Use which convert to see where it’s coming from.
- Missing delegates – Some formats (SVG, WebP) require extra libraries. Install them with sudo apt install libwebp-dev libsvg-dev.
- Permissions on /usr/local – If you compiled from source, ensure /usr/local/bin/magick is in your $PATH. Add export PATH=$PATH:/usr/local/bin to your .bashrc.
TL;DR
1. sudo apt install imagemagick for the repo version (6.x).
2. For ImageMagick 7, add the PPA: sudo add-apt-repository ppa:imagemagick-dev/stable.
3. Or compile from source if you want full control.
4. Install Ghostscript if PDF conversion is a must.
That’s it—now you can convert, resize, and remix images on Ubuntu without breaking your day.