ImageMagick lets you resize, crop, convert, and batch-process images directly from the command line on Fedora. Common use cases include converting hundreds of JPG files to PNG for web optimization, generating thumbnails automatically for galleries, adding watermarks to protect images, and creating animated GIFs from image sequences. By the end of this guide, you will have a working ImageMagick installation ready for format conversion, batch resizing, and automated image transformation tasks.
Choose Your ImageMagick Installation Method
Fedora offers multiple ways to install ImageMagick. Specifically, the DNF method provides ImageMagick 7 from Fedora’s official repositories with automatic updates. Alternatively, compiling from source gives you access to the absolute latest release and allows custom build configurations.
| Method | Channel | Version | Updates | Best For |
|---|---|---|---|---|
| DNF Package | Fedora Repos | Distribution package (stable) | Automatic via dnf upgrade | Most users who want easy installation and automatic updates |
| Compile from Source | GitHub Releases | Latest upstream | Manual recompilation required | Developers who need cutting-edge features or custom builds |
For most users, the DNF method is recommended because Fedora already provides ImageMagick 7 with the unified magick command and automatic security updates. Only compile from source if you specifically need features not yet available in the repository version or require custom compilation flags.
Method 1: Install ImageMagick via DNF
The DNF method installs ImageMagick 7 from Fedora’s official repositories. As a result, you get the unified magick command, automatic security updates, and minimal maintenance.
Update System Packages
First, refresh your package cache and update existing packages to prevent dependency conflicts:
sudo dnf upgrade --refresh
Install ImageMagick Package
Next, install ImageMagick along with its required libraries:
sudo dnf install ImageMagick
Verify Installation
Afterward, confirm ImageMagick installed correctly by checking the version:
magick --version
You should see output similar to:
Version: ImageMagick 7.1.1-47 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 jbig jng jp2 jpeg jxl lcms lqr ltdl lzma openexr png tiff webp wmf x xml zip zlib zstd
Fedora provides ImageMagick 7, which uses the unified
magickcommand instead of the legacyconvert,identify, andmogrifycommands. The legacy commands still work but display a deprecation warning. For new scripts and workflows, use themagickcommand.
Method 2: Install ImageMagick from Source
Compiling from source installs the latest ImageMagick release and allows you to customize build options such as enabling specific image format support or performance flags. However, this method requires more steps but provides maximum flexibility.
Install Build Dependencies
First, install all build dependencies using dnf builddep, which automatically pulls the compiler toolchain and development libraries required for ImageMagick:
sudo dnf builddep ImageMagick
This installs GCC, essential build tools, libtool-ltdl-devel (required for --with-modules), and all image format libraries including HEIC, JXL, and OpenEXR support.
If
dnf builddepis unavailable on older Fedora versions, install the core dependencies manually:sudo dnf install gcc gcc-c++ make git libtool-ltdl-devel pkg-config libjpeg-turbo-devel libpng-devel libtiff-devel giflib-devel freetype-devel lcms2-devel libxml2-devel bzip2-devel libwebp-devel
Clone the Repository
Download the ImageMagick source code from the official GitHub repository. For production systems, clone a specific release tag rather than the development branch:
git clone --depth 1 --branch 7.1.2-8 https://github.com/ImageMagick/ImageMagick.git
cd ImageMagick
The
--depth 1flag creates a shallow clone without full history, reducing download size. Check the releases page for the latest stable version and substitute accordingly.
Configure the Build
Then, run the configure script to detect your system configuration and prepare the build:
./configure --with-modules
The --with-modules flag enables dynamic loading of image format coders. A successful configuration displays a summary of enabled features, which you should review to confirm the image formats you need are detected.
Compile and Install
Compile ImageMagick using all available CPU cores:
make -j$(nproc)
Once compilation finishes, install ImageMagick system-wide:
sudo make install
Update Library Cache
Subsequently, configure the dynamic linker to find the new ImageMagick libraries:
sudo ldconfig /usr/local/lib
Without this step, you may encounter “cannot open shared object file” errors when running ImageMagick commands.
Verify Source Installation
Finally, confirm the installation by checking the version:
/usr/local/bin/magick --version
You should see ImageMagick 7.x output:
Version: ImageMagick 7.1.2-8 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 fontconfig freetype jng jpeg lcms ltdl lzma png tiff webp xml zlib
Additionally, test the installation with a quick image conversion using the built-in logo:
/usr/local/bin/magick logo: logo.gif && ls -la logo.gif
You should see a new logo.gif file created (approximately 27KB):
-rw-rw-r-- 1 user user 27055 Nov 30 12:00 logo.gif
Essential ImageMagick Commands
ImageMagick 7 introduces the unified magick command that replaces the legacy standalone utilities. The table below shows common operations and their modern equivalents.
| Command | Purpose | Example |
|---|---|---|
magick | Unified command for all image operations (recommended) | magick input.jpg output.png |
magick convert | Convert between formats or apply transformations | magick convert image.jpg -resize 50% small.jpg |
magick identify | Display image format, dimensions, and metadata | magick identify image.png |
magick mogrify | Modify images in place without creating copies | magick mogrify -resize 800x600 *.jpg |
magick composite | Combine multiple images into one | magick composite overlay.png base.png result.png |
magick montage | Create image grids or contact sheets | magick montage *.jpg -geometry 100x100 grid.png |
magick compare | Highlight differences between two images | magick compare old.png new.png diff.png |
magick import | Capture screenshots (requires X11) | magick import screenshot.png |
magick display | View images in a window (requires X11) | magick display image.jpg |
magick animate | Display image sequences as animation | magick animate *.gif |
Legacy commands like
convertandidentifystill work in ImageMagick 7 but display deprecation warnings. Update your scripts to use themagickprefix for forward compatibility.
Troubleshoot Installation Issues
Library Loading Errors After Source Installation
If you see a shared library error after compiling from source, the dynamic linker cannot find the ImageMagick libraries:
magick: error while loading shared libraries: libMagickCore-7.Q16HDRI.so.10: cannot open shared object file: No such file or directory
First, verify the library files exist:
ls /usr/local/lib/libMagick*
If the files exist, then update the library cache:
sudo ldconfig /usr/local/lib
If the error persists, add /usr/local/lib to the library path permanently:
echo '/usr/local/lib' | sudo tee /etc/ld.so.conf.d/imagemagick.conf
sudo ldconfig
Verify the fix by running:
/usr/local/bin/magick --version
You should see the ImageMagick version output without any library errors.
Missing Image Format Support
If ImageMagick cannot process certain image formats, the required delegate library was not detected during configuration. Check which formats are enabled:
magick identify -list format | grep -i "jpeg\|png\|webp\|heic"
You should see output listing supported formats:
HEIC* rw- High Efficiency Image Format (libheif 1.19.7)
JPEG* rw- Joint Photographic Experts Group JFIF format
PNG* rw- Portable Network Graphics
WEBP* rw- WebP Image Format
If your desired format is missing (no entry or --- instead of rw-), install the corresponding development package:
sudo dnf install libheif-devel # For HEIC/HEIF support
sudo dnf install libjxl-devel # For JPEG-XL support
After installing the missing libraries, return to the ImageMagick source directory (where you originally cloned it) and recompile:
cd ImageMagick
./configure --with-modules
make -j$(nproc)
sudo make install
sudo ldconfig /usr/local/lib
Verify the format is now enabled:
magick identify -list format | grep -i heic
Process Images with ImageMagick
ImageMagick 7 on Fedora uses the unified magick command for all image operations. The examples below demonstrate common tasks for batch processing, format conversion, and image manipulation.
Convert Image Formats
Convert a JPG image to PNG format when you need lossless compression or transparency support:
magick input.jpg output.png
ImageMagick automatically detects the output format from the file extension. Consequently, this works with over 200 image formats including WebP, HEIC, PDF, and SVG.
Create Thumbnails
Generate a 200×200 pixel thumbnail while preserving aspect ratio for image previews or galleries:
magick input.png -thumbnail 200x200 thumbnail.png
Using -thumbnail strips metadata and optimizes the image for web use, resulting in smaller file sizes than -resize.
Resize Images
Resize an image to exactly 800×600 pixels when you need precise dimensions regardless of aspect ratio:
magick input.png -resize 800x600! output.png
An exclamation mark forces exact dimensions, ignoring aspect ratio. In contrast, omitting it allows ImageMagick to maintain the original proportions within the specified bounds.
Add Text Watermarks
Overlay text on an image to protect copyright or add attribution:
magick input.png -font Arial -pointsize 36 -fill black -gravity southeast -annotate +10+10 "Copyright 2025" output.png
This places the text in the bottom-right corner with a 10-pixel margin, where the -gravity option controls positioning relative to image edges.
Batch Process Multiple Files
Convert all JPG files in a directory to PNG when migrating image formats for an entire project:
magick mogrify -format png *.jpg
When using -format, mogrify creates new files with the specified extension while leaving the original JPG files unchanged. For more examples and advanced techniques, see Examples of ImageMagick Usage.
Without the
-formatflag,mogrifyoverwrites the original files. For example,magick mogrify -resize 50% *.jpgpermanently replaces each JPG with a resized version. Always back up important images before batch processing with mogrify.
Remove ImageMagick
Remove DNF Installation
If you installed ImageMagick via DNF, remove it with:
sudo dnf remove ImageMagick
Afterward, verify ImageMagick is removed:
magick --version
You should see:
bash: magick: command not found...
Remove Source Installation
If you compiled from source, navigate to the source directory and run:
cd ImageMagick
sudo make uninstall
Next, update the library cache:
sudo ldconfig
Verify removal:
magick --version
You should see:
bash: magick: command not found
Finally, delete the cloned source directory and clean up any library configuration files you created:
cd ..
rm -rf ImageMagick
sudo rm -f /etc/ld.so.conf.d/imagemagick.conf
sudo ldconfig
Conclusion
You now have ImageMagick configured for batch image processing on Fedora. Start with basic conversions like magick input.jpg output.png, then explore batch operations with mogrify for larger workflows. For multimedia projects, pair ImageMagick with FFmpeg for video processing or GIMP for advanced editing.