LinuxCommandLibrary

ImageMagick

Convert, edit, compose, or display images

SYNOPSIS

magick [options...] [subcommand] input-file[...] [output-file]

PARAMETERS

-help
    Display usage summary and available options

-version
    Print ImageMagick version and build info

-list type
    List capabilities (formats, fonts, delegates, etc.)

-resize geometry
    Resize image to widthxheight (e.g., 800x600)

-quality value
    Set JPEG/MIFF/PNG compression quality (0-100)

-rotate angle
    Rotate image by degrees (90, 180, 270, arbitrary)

-crop geometry
    Crop image to specified widthxheight[+x+y]

-blur radius[xsigma]
    Apply Gaussian blur filter

-sharpen radius[xsigma]
    Sharpen image with unsharp mask

-strip
    Remove all profile/image metadata

-density DPI
    Set resolution for input/output

-colorspace type
    Convert to RGB/sRGB/GRAY/CMYK etc.

-gravity type
    Set North/South/East/West/Center for positioning

-font name
    Specify font for text annotations

-pointsize value
    Set font size for drawing text

-define key=value
    Set special format-specific parameters

-limit type value
    Limit memory/disk/time (e.g., memory 256MiB)

DESCRIPTION

ImageMagick is a comprehensive open-source software suite for creating, editing, composing, converting, and manipulating bitmap images. It supports over 200 image formats, including JPEG, PNG, GIF, TIFF, PDF, and more. The primary command-line interface in modern versions (7+) is magick, which unifies access to various tools like conversion, identification, and transformation.

Common tasks include resizing images with -resize, adjusting quality, applying filters (blur, sharpen, edge detect), rotating, cropping, adding text or watermarks, and batch processing. It excels in scripting and automation for web graphics, photo editing, scientific visualization, and media processing pipelines.

ImageMagick handles complex operations like image layering, morphology, Fourier transforms, and colorspace conversions (RGB, CMYK, grayscale). It's widely used in Linux environments, integrated with tools like Ghostscript for PDF handling. While powerful, it requires careful resource management due to potential high memory usage on large images.

The suite includes delegates for formats like SVG (via librsvg) and offers a Perl API (Magick::) for advanced scripting. Output can be to files, stdout, or named pipes.

CAVEATS

High memory usage on large images; historical security vulnerabilities in image parsing (e.g., buffer overflows)—process only trusted files or use sandboxing/policy.xml restrictions. Some formats require external delegates.

SUBCOMMANDS

convert (transform), identify (info/metadata), mogrify (in-place edit), composite (overlay), montage (thumbnails), animate (playback), display (GUI viewer)

SECURITY POLICIES

Edit /etc/ImageMagick-6/policy.xml to disable risky features: e.g., <policy domain="path" rights="none" pattern="@*"/>
Runtime: magick -define policy:memory=256MiB input.png output.jpg

HISTORY

Developed by John Cristy starting in 1990 on a Mac; ported to Unix in 1991. Gained popularity in 2000s for web/CD pipelines. Version 6 used separate binaries (convert, etc.); v7 (2017+) introduced unified magick CLI for better maintenance/portability.

SEE ALSO

convert(1), identify(1), mogrify(1), display(1), montage(1), GraphicsMagick(1)

Copied to clipboard