ImageMagick is a command-line toolkit for creating, editing, converting, and manipulating images in over 200 formats. Unlike GUI-based editors, ImageMagick excels at batch processing, automation, and integration into scripts and pipelines. Web developers use it to generate thumbnails on the fly, photographers rely on it for bulk format conversions, and system administrators embed it in workflows for watermarking, resizing, or extracting metadata from uploaded files.
This guide covers installing ImageMagick on Arch Linux, enabling optional format support, using core commands for conversions and transformations, and automating common image tasks with shell scripts. By the end, you will have a working installation with practical knowledge of the most useful ImageMagick operations.
Update Arch Linux
Before installing new packages, synchronize the package database and upgrade all installed packages:
sudo pacman -Syu
The -S flag synchronizes packages, -y refreshes the package database, and -u upgrades all installed packages. On a rolling-release distribution like Arch, keeping packages synchronized prevents dependency conflicts during installation.
Install ImageMagick on Arch Linux
Install ImageMagick from the official Arch Linux extra repository:
sudo pacman -S imagemagick
This installs the ImageMagick 7 command-line tools, shared libraries for development, and configuration files in /etc/ImageMagick-7/. The base installation includes support for common formats like PNG, JPEG, and TIFF through automatically pulled dependencies.
Verify the installation by checking the version:
magick --version
Version: ImageMagick 7.1.2-13 Q16-HDRI x86_64 https://imagemagick.org Copyright: (C) 1999 ImageMagick Studio LLC License: https://imagemagick.org/license/ Features: Cipher DPC HDRI Modules OpenCL OpenMP(4.5)
The Q16-HDRI designation indicates 16-bit color depth with High Dynamic Range Imaging support, which provides better color precision for professional image processing.
Install Optional Format Support
The base ImageMagick package lists several optional dependencies that enable additional format support. Install the ones you need based on the file types you work with:
| Package | Enabled Formats | Use Case |
|---|---|---|
ghostscript | PDF, PS, EPS | Converting between PDF and images, processing PostScript |
libheif | HEIC, HEIF, AVIF | iPhone photos, modern compressed formats |
libjxl | JPEG XL | Next-generation lossy/lossless image format |
libraw | DNG, CR2, NEF, ARW | Digital camera RAW files |
librsvg | SVG | Vector graphics rasterization |
libwebp | WebP | Web-optimized images (often installed as dependency) |
libultrahdr | Ultra HDR JPEG | HDR images with SDR backward compatibility |
libwmf | WMF, EMF | Windows Metafile vector graphics |
libzip | OpenRaster (ORA) | GIMP and Krita layered image format |
ocl-icd | N/A (acceleration) | OpenCL GPU acceleration for faster processing |
openexr | EXR | High dynamic range images for VFX and photography |
openjpeg2 | JPEG 2000 | High-quality archival images |
djvulibre | DjVu | Scanned documents |
pango | Advanced text | Complex text rendering with font shaping |
For a workstation that handles common web and photography formats, install the most useful optional dependencies:
sudo pacman -S ghostscript libheif libraw librsvg
For GPU-accelerated processing on systems with compatible hardware, add ocl-icd to enable OpenCL support. This speeds up operations on large images or batch processing tasks, though the performance gain depends on your specific GPU and the operations you perform.
Verify that the new formats are available by listing supported formats:
magick identify -list format | grep -E "PDF|HEIC|SVG"
HEIC* HEIC rw+ High Efficiency Image Format
PDF PDF rw+ Portable Document Format
SVG SVG rw+ Scalable Vector Graphics
The rw+ indicates read and write support with multi-image capability. The asterisk after HEIC indicates the format requires an external delegate (libheif) rather than being built into ImageMagick’s core.
Understand the ImageMagick Toolset
ImageMagick 7 consolidates most functionality under the unified magick command, though legacy command names remain available for compatibility. Understanding which tool to use for each task helps you write cleaner scripts:
| Command | Purpose | Example |
|---|---|---|
magick | Primary command for all operations in v7 | magick input.png output.jpg |
magick convert | Convert between formats with transformations | magick convert input.png -resize 50% output.jpg |
magick identify | Display image metadata and properties | magick identify -verbose photo.jpg |
magick mogrify | Modify images in place (overwrites original) | magick mogrify -resize 800x600 *.jpg |
magick composite | Overlay images (watermarks, layers) | magick composite watermark.png photo.jpg output.jpg |
magick montage | Create image grids and contact sheets | magick montage *.jpg -geometry 100x100 grid.jpg |
magick compare | Highlight differences between images | magick compare old.png new.png diff.png |
magick import | Capture screenshots from X11 | magick import screenshot.png |
The standalone commands (
convert,identify,mogrify) still work but are deprecated in ImageMagick 7. Use themagickprefix for forward compatibility:magick convertinstead ofconvert.
Convert and Transform Images
The most common ImageMagick task is converting images between formats with optional transformations applied during conversion. The general syntax specifies input, operations, and output:
Convert Between Formats
ImageMagick determines formats from file extensions. Convert a PNG to JPEG:
magick image.png image.jpg
For lossy formats like JPEG, control quality with the -quality option. Values range from 1 to 100, where higher numbers produce better visual quality but larger files. A quality of 85 typically offers a good balance between file size and visual fidelity for web use:
magick image.png -quality 85 image.jpg
Convert to WebP for web use with aggressive compression:
magick photo.jpg -quality 75 -define webp:method=6 photo.webp
The -define webp:method=6 enables the slowest but most efficient compression method.
Resize Images
Resize by specific dimensions, preserving aspect ratio by default:
magick large.png -resize 800x600 medium.png
The image scales to fit within 800×600 while maintaining its original aspect ratio. To force exact dimensions (which may distort the image), append an exclamation mark:
magick large.png -resize 800x600! forced.png
Resize by percentage:
magick large.png -resize 50% half-size.png
Verify the result:
magick identify half-size.png
half-size.png PNG 400x300 400x300+0+0 16-bit sRGB 45678B 0.000u 0:00.000
Crop Images
Extract a region from an image using the geometry format WIDTHxHEIGHT+X+Y, where X and Y specify the top-left corner offset:
magick photo.jpg -crop 640x480+100+50 cropped.jpg
This extracts a 640×480 region starting 100 pixels from the left edge and 50 pixels from the top.
Use gravity-based cropping to remove edges without calculating offsets:
magick photo.jpg -gravity South -chop 0x50 trimmed.jpg
This removes 50 pixels from the bottom of the image.
Rotate and Flip
Rotate by a specific angle (positive rotates clockwise):
magick photo.jpg -rotate 90 rotated.jpg
Mirror horizontally (flip left-right):
magick photo.jpg -flop mirrored.jpg
Mirror vertically (flip top-bottom):
magick photo.jpg -flip flipped.jpg
Batch Process Multiple Images
The mogrify command applies operations to multiple files in place, making it ideal for batch processing. Unlike convert, it overwrites original files by default.
The
mogrifycommand overwrites original files. Create backups first, or use the-pathoption to write results to a different directory. Test commands on a small sample before processing your entire collection.
Resize All Images in a Directory
Resize all JPEG files to a maximum dimension of 1920 pixels:
magick mogrify -resize 1920x1920 *.jpg
Convert Multiple Files to a Different Format
Convert all PNG files to JPEG in a separate output directory:
mkdir -p converted
magick mogrify -path converted -format jpg *.png
The original PNG files remain untouched, and new JPEG versions appear in the converted/ directory.
Process Files with Shell Loops
For more control over output filenames, use a shell loop with magick convert:
for file in *.png; do
magick "$file" -resize 800x600 -quality 85 "thumb_${file%.png}.jpg"
done
This creates thumbnails with a thumb_ prefix, converting PNG to JPEG in the process. The ${file%.png} syntax removes the .png extension from the original filename before adding the new .jpg extension. The quotes around "$file" are important for handling filenames that contain spaces.
Create Image Composites
ImageMagick can combine multiple images, add watermarks, and create contact sheets.
Add a Text Watermark
Add a semi-transparent text watermark to an image:
magick photo.jpg \
-gravity southeast \
-fill "rgba(255,255,255,0.5)" \
-pointsize 24 \
-annotate +10+10 "© 2026 Example" \
watermarked.jpg
The -gravity southeast positions the text in the bottom-right corner with a 10-pixel margin.
Overlay an Image Watermark
Overlay a logo or watermark image onto another image:
magick composite -gravity southeast -geometry +20+20 logo.png photo.jpg output.jpg
To make the overlay semi-transparent:
magick composite -dissolve 50 -gravity center logo.png photo.jpg blended.jpg
Create a Contact Sheet
Generate a grid of thumbnail images, useful for reviewing photo sets:
magick montage *.jpg -geometry 150x150+5+5 -tile 4x contact-sheet.jpg
This creates 150×150 pixel thumbnails arranged in a 4-column grid with 5-pixel spacing.
Work with PDFs and Documents
With Ghostscript installed, ImageMagick can convert between PDF and image formats.
Convert PDF Pages to Images
Convert all pages of a PDF to individual PNG images:
magick -density 150 document.pdf page-%03d.png
The -density 150 sets the resolution in DPI (higher values produce larger, sharper images). The %03d creates zero-padded page numbers: page-000.png, page-001.png, etc.
Convert only specific pages (page numbering starts at 0):
magick -density 150 document.pdf[0-2] first-three-pages.png
Create a PDF from Images
Combine multiple images into a single PDF:
magick *.jpg output.pdf
For scanned documents, add compression to reduce file size:
magick *.png -compress jpeg -quality 80 scanned-document.pdf
Inspect Image Information
The identify command displays image metadata and properties, useful for scripts that need to make decisions based on image characteristics.
Quick Format Check
Display basic information about an image:
magick identify photo.jpg
photo.jpg JPEG 1920x1080 1920x1080+0+0 8-bit sRGB 245678B 0.000u 0:00.000
The output shows filename, format, dimensions, color depth, colorspace, and file size.
Detailed Metadata
For complete metadata including EXIF data, use the verbose flag:
magick identify -verbose photo.jpg | head -50
Extract specific properties using format strings:
magick identify -format "Width: %w\nHeight: %h\nFormat: %m\nSize: %b\n" photo.jpg
Width: 1920 Height: 1080 Format: JPEG Size: 245678B
Troubleshoot Common Issues
PDF Conversion Security Policy (When Applicable)
Arch Linux ships ImageMagick with an “open” security policy that permits PDF processing by default. Unlike some distributions that restrict PDF operations out of the box, you can convert PDFs immediately after installing Ghostscript without modifying any configuration files.
If you encounter a policy error like:
attempt to perform an operation not allowed by the security policy `PDF'
This indicates custom security restrictions on your system, added by a system administrator or a previous configuration change. Check the policy file:
grep -n "PDF" /etc/ImageMagick-7/policy.xml
If you find a line like <policy domain="coder" rights="none" pattern="PDF" />, you can either comment it out or change rights="none" to rights="read|write":
sudo nano /etc/ImageMagick-7/policy.xml
PDF restrictions exist on some systems because malicious PDF files can exploit Ghostscript vulnerabilities. If your organization added these restrictions intentionally, consult your security policy before removing them. For personal systems processing trusted files, Arch’s default open policy is reasonable.
Missing Format Support
If ImageMagick reports an unknown format, check if the required optional dependency is installed:
magick identify -list format | grep -i heic
If the format is missing, identify the required package:
pacman -Si imagemagick | grep "Optional Deps" -A 20
Install the appropriate package (for example, libheif for HEIC support) and verify the format becomes available.
Memory Issues with Large Images
Processing very large images may exhaust system memory. Limit ImageMagick’s resource usage:
magick -limit memory 1GiB -limit map 2GiB huge-image.tiff output.jpg
For persistent limits, edit /etc/ImageMagick-7/policy.xml and adjust the resource policies:
<policy domain="resource" name="memory" value="1GiB"/>
<policy domain="resource" name="map" value="2GiB"/>
<policy domain="resource" name="disk" value="4GiB"/>
Color Profile Warnings
If you see warnings about missing color profiles or ICC profile mismatches when converting images:
iCCP: known incorrect sRGB profile
Strip the problematic profile during conversion:
magick input.png -strip output.png
The -strip option removes all metadata and profiles. If you need to preserve other metadata, use +profile "*" instead to remove only color profiles.
Remove ImageMagick
To remove ImageMagick and its unique dependencies that no other packages require:
sudo pacman -Rns imagemagick
The -Rns flags remove the package (-R), unneeded dependencies (-s), and backup configuration files (-n). Dependencies shared with other packages remain installed.
If you installed optional format support packages specifically for ImageMagick, you can remove them separately. First check whether other packages depend on them:
pacman -Qi ghostscript | grep "Required By"
If the package shows “Required By: None”, you can safely remove it. Only remove optional dependencies that no other software needs:
sudo pacman -Rns ghostscript libheif libraw librsvg
Verify removal:
pacman -Qi imagemagick
error: package 'imagemagick' was not found
Frequently Asked Questions
In ImageMagick 7, the magick command is the primary interface and convert is deprecated but still functional. Use magick or magick convert for forward compatibility. The standalone convert command may be removed in future versions.
Install the libheif package with sudo pacman -S libheif, then convert with: magick photo.HEIC photo.jpg. For batch conversion: magick mogrify -format jpg *.HEIC
The mogrify command is designed for in-place modification. To preserve originals, either create backups first, use the -path option to specify an output directory, or use convert in a shell loop instead.
The imagemagick-full AUR package includes additional format support and 32-bit color depth (Q32) instead of the standard 16-bit (Q16). It has many more dependencies (99+) and requires an AUR helper to install. If you need an AUR helper, see our guides for yay, paru, or pikaur. This package is intended for users needing maximum format compatibility or highest color precision for professional workflows. Most users should use the official repository package.
Conclusion
You now have ImageMagick installed on Arch Linux with format support configured for your workflow. The command-line tools handle everything from simple format conversions to batch processing thousands of images, making ImageMagick essential for any automated image workflow. For containerized environments, ImageMagick works well inside Docker containers for isolated image processing pipelines. For interactive editing, GIMP complements ImageMagick with a graphical interface for detailed manipulation. The Arch Wiki ImageMagick page covers additional topics, and the official ImageMagick Usage documentation provides extensive examples for advanced operations including animations, special effects, and complex compositing.