| Tested on | Ubuntu 24.04 LTS and 22.04 LTS |
|---|---|
| Package | imagemagick 8:6.9.12.98+dfsg1-5.2build2 (24.04)ghostscript 10.02.1~dfsg1-0ubuntu7.9 (24.04 PDF delegate) |
| Applies to | Ubuntu 24.04 LTS and 22.04 LTS |
| Privilege | sudo or root for apt and edits under /etc/ImageMagick-6/ |
| Scope | Install ImageMagick 6 from Ubuntu repositories, verify with convert and identify, run a quick resize test, add Ghostscript for PDF delegates, read /etc/ImageMagick-6/policy.xml, and uninstall. Does not cover ImageMagick 7 (magick) on Ubuntu 26.04 or PHP php-imagick. |
| Related guides | How to Install ImageMagick 7 on Ubuntu 26.04 bulk resize and convert images in Linux Check Ubuntu version apt command in Linux |
magick driver. Follow How to Install ImageMagick 7 on Ubuntu 26.04 instead of the convert-style examples on this page.
On Ubuntu 24.04 and 22.04, sudo apt install imagemagick installs ImageMagick 6. Your everyday commands are convert, identify, and mogrify. If a blog post only shows magick, it was written for 26.04.
Run convert --version, then a quick JPG-to-PNG test. Add Ghostscript when you need PDFs; if conversion still fails on files you trust, read /etc/ImageMagick-6/policy.xml before you change policy.
Quick answer
| Item | Ubuntu 24.04 / 22.04 |
|---|---|
| ImageMagick branch | 6 (6.9.12.x on 24.04, 6.9.11.x on 22.04) |
| Install | sudo apt install imagemagick |
| Primary commands | convert, identify, mogrify |
| Policy file | /etc/ImageMagick-6/policy.xml |
Confirm your release with check Ubuntu version before you copy examples from tutorials written for Ubuntu 26.04 and magick.
Choose an install method
| Method | Best for | Jump to |
|---|---|---|
| APT | Default — Ubuntu-managed ImageMagick 6 with security updates | Install with APT |
| Source | Newer upstream ImageMagick 7 tag or custom delegates | Install from source |
| AppImage | Portable ImageMagick 7 without make install |
AppImage |
APT covers a normal ImageMagick 6 setup. Source or AppImage is only when you need magick on an LTS that still ships version 6 in the archive.
Install ImageMagick on Ubuntu 24.04 & 22.04 with APT
Refresh package indexes
Run sudo apt update first—the same apt flow as any other package install:
sudo apt updateInstall the ImageMagick package
Install the metapackage:
sudo apt install -y imagemagickAPT pulls imagemagick-6.q16 and imagemagick-6-common automatically.
Verify the installed version
Check the version ImageMagick 6 reports through convert:
convert --versionVersion: ImageMagick 6.9.12-98 Q16 x86_64 18038 https://legacy.imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.phpOn 22.04, the version string shows 6.9.11-60 (or a newer security revision), but the same convert / identify workflow applies.
The Q16 line means this build uses 16-bit quantum depth per color channel.
Check which ImageMagick packages are installed
List installed DEB packages when you need the exact installed package version:
dpkg -l 'imagemagick*'ii imagemagick 8:6.9.12.98+dfsg1-5.2build2 amd64 image manipulation programs -- binaries
ii imagemagick-6-common 8:6.9.12.98+dfsg1-5.2build2 all image manipulation programs -- infrastructure
ii imagemagick-6.q16 8:6.9.12.98+dfsg1-5.2build2 amd64 image manipulation programs -- quantum depth Q16See what Ubuntu would install before you run apt
When ImageMagick is not installed yet, apt-cache policy shows the candidate version:
apt-cache policy imagemagickimagemagick:
Installed: 8:6.9.12.98+dfsg1-5.2build2
Candidate: 8:6.9.12.98+dfsg1-5.2build2
Version table:
*** 8:6.9.12.98+dfsg1-5.2build2 500
500 http://archive.ubuntu.com/ubuntu noble/universe amd64 PackagesCandidate should be 6.9.x, not a 7.1.x ImageMagick 7 package.
Test ImageMagick with a simple image conversion
Create a scratch directory, then build a solid-color JPEG:
mkdir -p /tmp/im-testFill a tiny red rectangle and save it as JPEG:
convert -size 120x80 xc:red /tmp/im-test/input.jpgconvert prints nothing on success, so turn the JPEG into a PNG:
convert /tmp/im-test/input.jpg /tmp/im-test/output.pngls should list the new PNG:
ls -l /tmp/im-test/output.png-rw-r--r-- 1 user user 169 Oct 20 10:59 /tmp/im-test/output.pngShrink the test image to half size:
convert /tmp/im-test/input.jpg -resize 50% /tmp/im-test/resized.jpgidentify prints geometry and format without writing a new file:
identify /tmp/im-test/output.png/tmp/im-test/output.png PNG 120x80 120x80+0+0 8-bit sRGB 2c 169B 0.000u 0:00.000For more batch resize and format recipes, see bulk resize and convert images in Linux.
Install Ghostscript for PDF and PostScript
PDFs usually need Ghostscript as a delegate. Install it alongside ImageMagick:
sudo apt install -y ghostscriptConfirm Ghostscript is on disk before you retry PDF conversion:
dpkg -l ghostscriptii ghostscript 10.02.1~dfsg1-0ubuntu7.9 amd64 interpreter for the PostScript language and for PDFEven with Ghostscript installed, security policy can block PDF/PS coders. Adjust policy only for trusted workloads (next section).
Do you need ImageMagick development headers?
You do not need development packages for normal convert or identify commands.
If you are compiling an application against ImageMagick, install the ImageMagick 6 development package:
sudo apt install libmagickwand-6.q16-devphp-imagick is different—it is the PHP extension, not the imagemagick command-line metapackage.
ImageMagick security policy on Ubuntu 24.04 and 22.04
ImageMagick 6 reads policy.xml to cap delegates, coders, and memory use:
| Path | Role |
|---|---|
/etc/ImageMagick-6/policy.xml |
Default Ubuntu policy for convert / identify |
List coder-related rules before you change anything:
grep -E 'pattern="(PDF|PS|EPS)"' /etc/ImageMagick-6/policy.xmlDefaults vary by release and security updates, so read the file on your host.
When PDF conversion fails with a policy error on trusted documents:
- Change only the minimum rule required (for example a specific
<policy domain="coder" … pattern="PDF" />entry) - Keep backups before you edit
policy.xml - Avoid blanket
rights="none"removals on systems that accept arbitrary uploads
ImageMagick documents policy design on its security policy page.
Optional: Install ImageMagick 7 from source
Build from source when you want ImageMagick 7 (magick) on 24.04 or 22.04 but keep apt’s ImageMagick 6, or when Ubuntu’s package lacks a delegate you need.
Install Git, the toolchain, and common delegate headers:
sudo apt install -y git build-essential pkg-config libjpeg-dev libpng-dev libtiff-dev libwebp-dev libfreetype6-dev libxml2-dev liblcms2-devClone a tagged upstream release (pick the current tag from ImageMagick’s site):
git clone --depth 1 --branch 7.1.2-34 https://github.com/ImageMagick/ImageMagick.git ~/ImageMagick-srcMove into the source tree:
cd ~/ImageMagick-srcRun the configure script so the build detects libraries on your system:
./configureCompile with parallel jobs, then install under /usr/local (this does not remove apt’s convert):
make -j"$(nproc)"Install the binaries and libraries:
sudo make installRefresh the dynamic linker cache so the system sees /usr/local/lib:
sudo ldconfig /usr/local/libSource installation places ImageMagick 7 under /usr/local; it is not managed by APT. If you keep apt’s ImageMagick 6 installed, check which magick when a script picks the wrong binary.
Verify the ImageMagick 7 binary:
/usr/local/bin/magick --versionUse the full path or put /usr/local/bin ahead of /usr/bin when scripts should call magick instead of convert.
Optional: Run ImageMagick 7 with AppImage
Download the current x86_64 AppImage from ImageMagick’s download page, then make it executable:
chmod +x ImageMagick-*-x86_64.AppImageOptionally rename it for simpler commands:
mv ImageMagick-*-x86_64.AppImage magickVerify:
./magick --versionUpstream’s AppImage may ship with an open security policy. Define a policy.xml appropriate for your environment before you process untrusted files in production.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
E: Unable to locate package imagemagick |
universe disabled or stale indexes | sudo add-apt-repository universe, sudo apt update, then sudo apt install imagemagick |
convert: command not found |
Package not installed | sudo apt install imagemagick; verify with convert --version |
magick: command not found on 24.04/22.04 |
Release ships ImageMagick 6 only | Use convert / identify, build ImageMagick 7 from source, or use an AppImage |
no decode delegate for this image format |
Missing library or Ghostscript for PDF | Install ghostscript and format libraries; for source builds, re-run ./configure |
| PDF conversion blocked | Policy or missing Ghostscript | Install ghostscript; review /etc/ImageMagick-6/policy.xml for trusted use only |
When apt reports Unable to locate package imagemagick, enable universe and run sudo apt update—on minimal images you may need software-properties-common first; see add-apt-repository command not found.
Uninstall ImageMagick
Remove the metapackage when you no longer need the tools:
sudo apt remove imagemagickDrop configuration files as well with purge (see remove software on Ubuntu for remove vs purge):
sudo apt purge imagemagickClean up unused dependencies:
sudo apt autoremoveIf you installed ImageMagick 7 under /usr/local, remove it from the same source tree with sudo make uninstall before you delete libraries by hand.
Summary
On 24.04 and 22.04, sudo apt install imagemagick gives you ImageMagick 6. convert, identify, and mogrify are the commands you use every day; policy sits in /etc/ImageMagick-6/policy.xml. convert --version plus one convert input.jpg output.png test is usually all you need on a server or desktop.
Add Ghostscript for PDF or PostScript. Only edit policy.xml when you know why you are loosening a rule—not as a quick fix on a host that takes random uploads.
Upgrade to 26.04 later? Switch to the ImageMagick 7 guide and magick so your scripts match the newer package.
References
- ImageMagick — official site
- ImageMagick download and source build
- ImageMagick security policy
- Ubuntu Packages — imagemagick (noble)
Frequently Asked Questions
Does Ubuntu 24.04 use ImageMagick 6 or 7?
Yes—Noble ships ImageMagick 6 in apt (for example 8:6.9.12.98+dfsg1-5.2build2). Use convert and identify unless you built or installed ImageMagick 7 yourself.
Is the install the same on Ubuntu 22.04?
Yes for day-to-day commands: both releases ship ImageMagick 6 with convert, identify, and mogrify. The exact 6.9.11 vs 6.9.12 package revision differs; verify with convert --version on your host.
Why do tutorials show magick instead of convert?
ImageMagick 7 unified operations under magick. Ubuntu 26.04 adopted that branch; 24.04 and 22.04 stayed on ImageMagick 6. Translate magick input.jpg output.png to convert input.jpg output.png on those LTS releases.
Should I install php-imagick for shell conversions?
No. php-imagick is a PHP extension for web apps. For command-line conversion, install the imagemagick package only.

