magick-convert
Convert image file formats
TLDR
Convert an image from JPEG to PNG
Scale an image to 50% of its original size
Scale an image keeping the original aspect ratio to a maximum dimension of 640x480
Scale an image to have a specified file size
Vertically/horizontally append images and have the empty space be transparent
Create a GIF from a series of images with 100ms delay between them
Create an image with nothing but a solid red background
Create a favicon from several images of different sizes
SYNOPSIS
magick-convert [options] input_file [output_file]
PARAMETERS
-resize geometry
Resizes the image. geometry can be 'WxH', 'W', 'xH', 'WxH!', 'WxH>', 'WxH<', etc.
-crop geometry[+X[+Y]]
Crops the image to the specified geometry.
-quality value
Sets the JPEG/MIFF/PNG compression level. A value from 0 (lowest quality, highest compression) to 100 (highest quality, lowest compression).
-format image_format
Specifies the output image format, e.g., 'jpeg', 'png', 'gif'.
-blur radius[xsigma]
Blurs the image using a Gaussian operator.
-colorspace colorspace
Transforms the image to a specific colorspace, e.g., 'sRGB', 'CMYK', 'Gray'.
-composite
Composites multiple images together. Often used with '-gravity' and '-geometry'.
-define key=value
Defines one or more image processing settings or read/write options specific to a format.
-strip
Strips the image of any profiles, comments, or other extraneous information.
DESCRIPTION
magick-convert is a versatile command-line utility from the ImageMagick suite, primarily used for converting images between different formats and performing a wide array of image processing operations.
It can resize, crop, rotate, flip, and distort images, adjust colors, apply various artistic effects, draw text and shapes, and composite multiple images. It supports over 200 image formats including popular ones like JPEG, PNG, GIF, TIFF, BMP, PDF, and SVG.
As part of ImageMagick 7, magick-convert represents the modern approach to image manipulation, often superseding the direct use of the 'convert' command found in older versions. Its power lies in its extensive options and the ability to chain operations, making it an indispensable tool for photographers, web developers, and system administrators for batch processing, web graphics optimization, and generating thumbnails or watermarks.
CAVEATS
Due to its extensive feature set, magick-convert can be complex to master, especially for advanced operations or specific format requirements. Processing very large images or performing numerous complex operations can be resource-intensive, consuming significant CPU and memory. When dealing with untrusted input images, there's a potential security risk if ImageMagick is not properly configured or updated, as maliciously crafted images could exploit vulnerabilities.
CHAINING OPERATIONS
One of the most powerful features of magick-convert is its ability to chain multiple operations sequentially. Arguments are parsed from left to right, with each operation acting on the image as it currently stands. This allows for complex image processing pipelines to be defined in a single command line, making it highly efficient for scripts and batch processing.
INPUT AND OUTPUT FLEXIBILITY
magick-convert can read images from standard input (by specifying '-' as the input file) and write to standard output, facilitating its use in shell pipelines. It also supports reading images from remote URLs and creating images on the fly from various primitives like solid colors or gradients.
HISTORY
magick-convert is part of the ImageMagick 7 suite. Historically, image conversion and manipulation were primarily handled by the standalone 'convert' command in ImageMagick 6 and earlier versions. With the release of ImageMagick 7, a unified 'magick' command was introduced, acting as a dispatcher for various operations. While 'convert' might still exist (often as a symbolic link to 'magick'), 'magick-convert' is the recommended and explicit way to invoke the image conversion functionality, aligning with the new modular architecture of ImageMagick.
SEE ALSO
magick(1), magick-identify(1), magick-mogrify(1), magick-montage(1), magick-composite(1)