How to Install ImageMagick on Rocky Linux

ImageMagick is a command-line image processing toolkit that supports over 200 image formats and provides tools for resizing, cropping, converting, and manipulating images. Common use cases include generating thumbnails for web applications, batch converting images between formats, and automating image processing pipelines in development workflows. By the end of this guide, you will have ImageMagick installed and verified on your Rocky Linux system, ready for image processing tasks.

Rocky Linux 8, 9, and 10 all require the EPEL (Extra Packages for Enterprise Linux) repository to install ImageMagick, as it is not included in the default AppStream repositories. This guide covers both the EPEL package manager method and compiling from source for users who need the absolute latest version or custom build options.

Choose Your ImageMagick Installation Method

Rocky Linux offers two approaches to installing ImageMagick, each suited to different requirements.

MethodChannelVersionUpdatesBest For
DNF with EPELEPEL RepositoryRocky 8/9: ImageMagick 6.x; Rocky 10: ImageMagick 7.xAutomatic via dnf upgradeMost users who want stable, tested packages
Source CompilationGitHub ReleasesLatest 7.xManual recompilationUsers needing the newest features or custom build options

For most users, we recommend the EPEL method because it provides automatic security updates and requires minimal maintenance. However, source compilation becomes useful when you need features only available in the latest release or require specific build flags that the packaged version does not include.

Rocky Linux 10 includes ImageMagick 7.x from EPEL, which introduces the magick command as the primary interface. Rocky Linux 8 and 9 include ImageMagick 6.x, which uses the legacy convert, identify, and mogrify commands. This guide provides version-appropriate verification commands for each release.

Method 1: Install ImageMagick via EPEL Repository

The EPEL repository provides tested, stable ImageMagick packages that integrate cleanly with Rocky Linux’s package management system. As such, this method offers the fastest path to a working installation.

Update Rocky Linux System Packages

Before installing new software, update your existing packages to ensure you have the latest security patches and dependency versions:

sudo dnf upgrade --refresh

This command refreshes the repository metadata and upgrades all installed packages. Depending on when you last updated your system, the process may take a few minutes.

Install the EPEL Repository

Next, add the EPEL (Extra Packages for Enterprise Linux) repository, which provides ImageMagick packages. Rocky Linux includes this repository in its extras collection, so you can install it directly with DNF:

sudo dnf install epel-release

This command works on Rocky Linux 8, 9, and 10. Once installation completes, DNF automatically fetches metadata from EPEL on your next package operation.

Install ImageMagick

With EPEL now enabled, you can install ImageMagick using DNF:

sudo dnf install ImageMagick

DNF resolves and installs all required dependencies automatically. Additionally, the installation includes the core ImageMagick libraries and command-line tools. On Rocky Linux 10, DNF installs ImageMagick 7.x, while Rocky Linux 8 and 9 receive ImageMagick 6.x.

Verify the ImageMagick Installation

Once installation completes, verify that ImageMagick works correctly and check the installed version. Because the verification command differs between ImageMagick versions, use the appropriate command for your Rocky Linux release.

Rocky Linux 10 (ImageMagick 7.x):

magick --version
Version: ImageMagick 7.x.x-x Q16-HDRI x86_64 https://imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP(4.5) 
Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype gslib gvc heic jbig jng jp2 jpeg jxl lcms lqr ltdl lzma openexr pangocairo png ps raqm raw rsvg tiff webp wmf x xml zip zlib zstd

Rocky Linux 8 and 9 (ImageMagick 6.x):

convert --version
Version: ImageMagick 6.9.x-x Q16 x86_64 https://legacy.imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP(4.5) 
Delegates (built-in): bzlib cairo djvu fontconfig freetype gslib gvc jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps raqm raw rsvg tiff webp wmf x xml zlib

The “Delegates” line shows the supported image formats. In particular, a longer list indicates broader format support, which depends on the libraries the build process detected.

Method 2: Compile ImageMagick from Source

Alternatively, compiling from source provides access to the latest ImageMagick release and allows custom build configurations. This approach requires more setup but gives you full control over features and optimizations.

Source compilation installs ImageMagick to /usr/local by default, separate from system packages. This means you can have both the EPEL version and a source-compiled version installed simultaneously, though you should avoid this to prevent confusion. If you previously installed via EPEL, remove that version first with sudo dnf remove ImageMagick.

Install Build Dependencies

First, install the required development headers and libraries for image formats and optional features. The dnf builddep command installs all dependencies needed to compile the package, but it requires both EPEL and the CodeReady Builder (CRB) repository. Unlike the EPEL package method, source compilation needs CRB for the -devel packages.

Rocky Linux 9 and 10:

sudo dnf install epel-release
sudo dnf config-manager --set-enabled crb
sudo dnf builddep ImageMagick -y

Rocky Linux 8:

sudo dnf install epel-release
sudo dnf config-manager --set-enabled powertools
sudo dnf builddep ImageMagick -y

If the dnf config-manager command is not found, install the dnf-plugins-core package first: sudo dnf install dnf-plugins-core.

As a result, the builddep command reads the package specification from EPEL and installs development packages for image formats (JPEG, PNG, TIFF, WebP), fonts, compression libraries, and build tools.

Download the ImageMagick Source Code

Next, create a build directory and download the latest stable release from the ImageMagick GitHub releases page. The following commands automatically detect the current version:

mkdir -p ~/imagemagick-build && cd ~/imagemagick-build
VERSION=$(curl -s https://api.github.com/repos/ImageMagick/ImageMagick/releases/latest | grep -oP '"tag_name": "\K[^"]+')
echo "Downloading ImageMagick version: ${VERSION}"
curl -fL "https://github.com/ImageMagick/ImageMagick/archive/refs/tags/${VERSION}.tar.gz" -o "ImageMagick-${VERSION}.tar.gz"
Downloading ImageMagick version: 7.x.x-x
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 15.2M  100 15.2M    0     0  8.5M      0  0:00:01  0:00:01 --:--:-- 8.5M

Extract and Configure the Build

Now extract the downloaded archive and run the configure script to prepare the build:

tar -xzf ImageMagick-${VERSION}.tar.gz
cd ImageMagick-${VERSION}
./configure --with-modules

The configure script checks for available libraries and generates the build configuration. The --with-modules flag enables dynamic loading of image format handlers, allowing ImageMagick to support additional formats without recompiling. Configuration typically takes 1-2 minutes.

checking for OpenSSL... yes
checking for libpng... yes
checking for libjpeg... yes
checking for libtiff... yes
checking for libwebp... yes
...
configure: creating ./config.status
config.status: creating Makefile

Configuration complete. Type make (or gmake on some *BSD machines) to compile.

Review the configure output to verify that it detected your desired image formats. If a format shows “no” when you expect “yes,” install the corresponding -devel package and run ./configure again.

Compile and Install ImageMagick

After configuration succeeds, compile the source code using all available CPU cores for faster builds, then install to the system:

make -j$(nproc)
sudo make install

Compilation time depends on your system’s CPU and memory. Typically, on a modern system with 4+ cores, expect 5-10 minutes. The -j$(nproc) flag uses all available CPU cores.

Update the Shared Library Cache

Once installation finishes, update the system’s shared library cache so the linker recognizes the newly installed libraries:

sudo ldconfig

Specifically, the ldconfig command scans the standard library directories (including /usr/local/lib where ImageMagick installs its libraries) and updates the runtime linker cache.

Verify the Source Installation

Finally, confirm that the source-compiled version works correctly:

magick --version
Version: ImageMagick 7.x.x-x Q16-HDRI x86_64 https://imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP(4.5) 
Delegates (built-in): bzlib cairo fftw fontconfig freetype heic jbig jng jp2 jpeg jxl lcms lqr ltdl lzma openexr pangocairo png raqm raw rsvg tiff webp wmf x xml zip zlib zstd

The version number should match what you downloaded. Source-compiled installations typically include more delegates than the packaged version because you control which libraries are available during the build.

Manage ImageMagick

Update EPEL Installation

Standard system updates include ImageMagick updates automatically. Therefore, to check for and apply available updates, run:

sudo dnf upgrade ImageMagick

Alternatively, to see whether a new version is available without installing it, use:

dnf check-update ImageMagick

Update Source Installation

Source installations require manual updates. Before updating, check the releases page for new versions and changelog entries that might affect your usage.

The following commands perform the update process step by step:

  • Version detection: Fetches the latest version from GitHub and compares it with your installed version.
  • Download: Retrieves the source archive for the new version.
  • Build: Compiles the new version using all available CPU cores.
  • Install: Overwrites the previous installation (no uninstall needed).

To update, navigate to your build directory and run these commands:

cd ~/imagemagick-build

# Check current and latest versions
VERSION=$(curl -s https://api.github.com/repos/ImageMagick/ImageMagick/releases/latest | grep -oP '"tag_name": "\K[^"]+')
echo "Current version: $(magick --version 2>/dev/null | head -1 || echo 'Not installed')"
echo "Latest version: ${VERSION}"

# Download new version
echo "Downloading ImageMagick ${VERSION}..."
curl -fL "https://github.com/ImageMagick/ImageMagick/archive/refs/tags/${VERSION}.tar.gz" -o "ImageMagick-${VERSION}.tar.gz"

# Extract and build
echo "Extracting source..."
tar -xzf "ImageMagick-${VERSION}.tar.gz"
cd "ImageMagick-${VERSION}"

echo "Configuring build..."
./configure --with-modules

echo "Compiling (this may take 5-10 minutes)..."
make -j$(nproc)

echo "Installing..."
sudo make install
sudo ldconfig

echo "Update complete. Installed version:"
magick --version | head -1

When you run the update, you will see output similar to this:

Current version: Version: ImageMagick 7.1.2-10 Q16-HDRI x86_64
Latest version: 7.1.2-12
Downloading ImageMagick 7.1.2-12...
  % Total    % Received % Xferd  Average Speed
100 15.2M  100 15.2M    0     0  8.5M      0  0:00:01
Extracting source...
Configuring build...
checking for OpenSSL... yes
checking for libpng... yes
...
Compiling (this may take 5-10 minutes)...
...
Installing...
Update complete. Installed version:
Version: ImageMagick 7.1.2-12 Q16-HDRI x86_64

If the version check shows that you already have the latest version, you can skip the remaining steps.

Basic ImageMagick Usage Examples

ImageMagick provides several command-line tools for processing images. On ImageMagick 7.x (Rocky Linux 10), use the magick command followed by the operation. In contrast, ImageMagick 6.x (Rocky Linux 8/9) uses individual commands directly.

Convert an image format:

# ImageMagick 7.x (Rocky 10)
magick input.png output.jpg

# ImageMagick 6.x (Rocky 8/9)
convert input.png output.jpg

Resize an image:

# ImageMagick 7.x (Rocky 10)
magick input.jpg -resize 800x600 output.jpg

# ImageMagick 6.x (Rocky 8/9)
convert input.jpg -resize 800x600 output.jpg

Get image information:

# ImageMagick 7.x (Rocky 10)
magick identify input.jpg

# ImageMagick 6.x (Rocky 8/9)
identify input.jpg

Troubleshooting

Command Not Found After Installation

If magick or convert returns “command not found” after installing via EPEL, verify the package installation:

rpm -q ImageMagick

For source installations, the commands install to /usr/local/bin. Consequently, verify this directory is in your PATH:

echo $PATH | grep -q /usr/local/bin && echo "Path OK" || echo "Add /usr/local/bin to PATH"

Missing Image Format Support

If ImageMagick reports an unsupported format when processing images, check which delegates are compiled in:

# ImageMagick 7.x
magick --version | grep Delegates

# ImageMagick 6.x
convert --version | grep Delegates

Similarly, common missing formats and their required packages include:

  • HEIC/HEIF: libheif-devel (EPEL)
  • WebP: libwebp-devel
  • JPEG XL: libjxl-devel (EPEL)
  • RAW camera formats: LibRaw-devel (EPEL)

For source installations, you must install the missing development package and recompile ImageMagick. However, EPEL installations have their supported formats fixed by the package build.

Library Not Found Errors

If you see “error while loading shared libraries” after a source installation, the system has a stale library cache. To fix this, run:

sudo ldconfig

If the error persists, verify that the library search path includes /usr/local/lib:

cat /etc/ld.so.conf.d/*.conf | grep /usr/local/lib || echo "/usr/local/lib" | sudo tee /etc/ld.so.conf.d/local.conf
sudo ldconfig

Remove ImageMagick

If you need to remove ImageMagick from your system, note that the process differs between installation methods.

Remove EPEL Installation

First, uninstall the package and remove unused dependencies:

sudo dnf remove ImageMagick
sudo dnf autoremove

Then verify the removal succeeded:

rpm -q ImageMagick
package ImageMagick is not installed

Remove Source Installation

If you kept the build directory, use the Makefile to uninstall:

cd ~/imagemagick-build/ImageMagick-*
sudo make uninstall
sudo ldconfig

If you no longer have the build directory, you can manually remove the installed files from /usr/local/bin, /usr/local/lib, /usr/local/include, and /usr/local/share/ImageMagick-7. Be careful not to remove files belonging to other software.

Finally, you can optionally remove the build directory. This command permanently deletes the source files, so back up any modified scripts first:

rm -rf ~/imagemagick-build

Conclusion

You have successfully installed ImageMagick on your Rocky Linux system, gaining access to command-line tools for image format conversion, resizing, and manipulation. The EPEL method delivers automatic updates with minimal maintenance, while source compilation offers the latest features and customization. With ImageMagick now available, you can automate image processing tasks, integrate batch operations into scripts, and support a wide range of image formats in your workflows.

Leave a Comment

Let us know you are human: