LinuxCommandLibrary

magick

Convert, edit, and compose images

TLDR

Convert between image formats

$ magick [path/to/input_image.png] [path/to/output_image.jpg]
copy

Resize an image, making a new copy
$ magick [path/to/input_image.jpg] -resize [100x100] [path/to/output_image.jpg]
copy

Create a GIF out of all JPEG images in the current directory
$ magick [*.jpg] [path/to/images.gif]
copy

Create a checkerboard pattern
$ magick -size [640x480] pattern:checkerboard [path/to/checkerboard.png]
copy

Create a PDF file out of all JPEG images in the current directory
$ magick [*.jpg] -adjoin [path/to/file.pdf]
copy

SYNOPSIS

magick [global_options] {input_file | input_glob} [image_processing_options] [output_file]
magick [global_options] subcommand [subcommand_options] arguments

Examples:
magick input.jpg -resize 50% output.png
magick identify image.png

PARAMETERS

-debug level
    Enable debug logging to help diagnose issues.

-limit resource value
    Set a resource limit (e.g., memory, disk, threads) to control consumption during processing.

-monitor
    Monitor program progress, displaying a percentage complete.

-verbose
    Print detailed information about the image and its processing steps.

-version
    Print the ImageMagick version number and build features.

-help
    Display a comprehensive list of all ImageMagick command-line options.

-resize geometry
    Resize an image. Examples: 50%, 200x100, x150.

-crop geometry
    Crop an image to a specified size and offset. Example: 100x100+10+10.

-quality value
    Set the image compression quality for formats like JPEG (0-100).

-format format
    Specify the output image format (e.g., png, gif, webp).

-gravity direction
    Control placement when compositing or drawing text (e.g., NorthWest, Center).

-fill color
    Set the fill color for subsequent drawing operations.

-pointsize value
    Set the font size for text annotation.

DESCRIPTION

magick is the unified command-line tool from the ImageMagick suite, a powerful open-source software suite for creating, editing, composing, or converting bitmap images. It supports over 200 image file formats (e.g., JPEG, PNG, GIF, TIFF, DPX, EXR, WebP, PDF, SVG).

The magick command consolidates the functionality of older ImageMagick tools like convert, mogrify, identify, composite, and display into a single executable, allowing for simpler command invocation. It's widely used for batch processing, web development, graphic design, and scientific applications where image manipulation is required. Capabilities include resizing, cropping, color adjustment, applying filters, adding text, drawing, and more. It is designed to be scriptable, enabling complex image workflows.

CAVEATS

magick can be very resource-intensive, especially with large images or complex operations, potentially consuming significant CPU, memory, and disk I/O. Its extensive options provide immense power but also contribute to a steep learning curve for advanced usage. Older ImageMagick versions had known security vulnerabilities (e.g., 'ImageTragick'), so keeping your ImageMagick installation updated is crucial, especially when processing untrusted user-supplied content.

SUBCOMMANDS

While magick can perform many operations directly, it also supports subcommands like convert, identify, mogrify, composite, compare, etc. For example, magick convert input.jpg output.png is equivalent to magick input.jpg output.png when only simple conversion/manipulation is needed, but magick identify image.png is the preferred way to get image information.

SCRIPTING AND AUTOMATION

magick is designed to be highly scriptable, making it ideal for automating repetitive image tasks. It can be easily integrated into shell scripts (Bash, Zsh), Python, PHP, Perl, and other programming languages, allowing for dynamic image generation and processing in web applications or backend services.

HISTORY

ImageMagick was first released in 1990 by John Cristy at DuPont. Over the years, it evolved into a comprehensive suite of command-line tools. Historically, different functions were handled by separate executables like convert (for conversions), identify (for image info), and mogrify (for in-place modifications). With ImageMagick 7, the magick command was introduced as a unified front-end, consolidating these functionalities to simplify invocation and improve consistency, making it the primary interface for most operations.

SEE ALSO

convert(1), mogrify(1), identify(1), composite(1), display(1)

Copied to clipboard