convert.im6
Convert images between different formats
SYNOPSIS
convert [input-options] input-file [output-options] output-file
PARAMETERS
input-file
Path to the source image file. Can also be a glob pattern, a URL, or - for standard input.
output-file
Path to the destination image file. The extension usually determines the output format, or - for standard output.
-resize geometry
Scales an image. geometry examples: 120x120! (exact size), 50% (percentage), x200 (height only).
-crop geometry[+offset]
Extracts a rectangular region from the image. geometry example: 100x150+10+20 (width x height at x,y offset).
-rotate degrees
Rotates the image by the specified degrees (e.g., 90, 270).
-format format
Explicitly specifies the output image format (e.g., jpg, png, gif).
-quality value
Sets the compression value for lossy formats (JPEG, MIFF, PNG) from 0 (lowest) to 100 (highest quality).
-background color
Defines the canvas color used for operations like -extent or -rotate when new areas are exposed.
-extent geometry
Sets the image size and fills any newly exposed areas with the background color. Used for padding or cropping.
-strip
Strips all profiles, comments, and metadata from the image, reducing file size.
-monochrome
Converts the image to pure black and white pixels.
-type type
Sets the image type (e.g., Grayscale, TrueColor, Palette).
-composite
Overlays images. Requires multiple input images or a separate overlay image, often combined with -geometry and -gravity.
-draw drawing-string
Draws shapes or text on the image using a specific drawing-string syntax (e.g., 'rectangle 10,10 50,50').
-annotate geometry text
Annotates the image with text at a specified geometry (position and rotation).
-font name
Specifies the font to use for text operations like -annotate or -draw.
-gravity direction
Sets the initial gravity (e.g., NorthWest, Center) for text and image placement.
-density WxH
Sets the image density for rasterizing vector formats (e.g., 300x300 for 300 DPI).
-flatten
Merges all layers of a multi-layer image into a single, flat image.
-blur radiusxsigma
Applies a Gaussian blur filter to the image.
-gamma value
Applies a gamma correction to the image.
-trim
Removes any edges that are the same color as the corner pixels.
-level black_point,white_point
Adjusts the image levels by mapping pixel values.
-threshold value
Forces pixels to be either black or white based on a threshold value.
-auto-orient
Automatically rotates the image based on EXIF orientation tag.
DESCRIPTION
convert is a versatile command-line utility from the ImageMagick suite, renowned for its ability to convert images between formats, resize, crop, rotate, and apply numerous graphical effects. It supports over 200 image formats, including common ones like JPEG, PNG, GIF, TIFF, BMP, SVG, and PDF. The convert.im6 variant specifically refers to ImageMagick version 6, which was a widely adopted and stable release. It empowers users to perform complex image processing tasks through powerful scripting, making it an indispensable tool for automating image workflows in Linux environments. From simple format changes to intricate composite operations, convert offers robust control over image attributes and pixel data.
CAVEATS
convert is part of ImageMagick version 6. In ImageMagick 7, it is deprecated in favor of the unified magick command (e.g., magick convert ... or simply magick ...).
The order of operations matters significantly, as convert processes options sequentially from left to right.
It can be resource-intensive for very large images or complex, chained operations, potentially consuming significant memory and CPU.
IMAGEMAGICK VS. GRAPHICSMAGICK
While convert exists in both ImageMagick and GraphicsMagick (a fork of ImageMagick from 2002), the convert.im6 explicitly refers to ImageMagick version 6. Their command-line syntax and capabilities can differ slightly, so it's important to know which suite is being used to ensure correct behavior.
PIPING AND STANDARD I/O
convert can read image data from standard input by specifying - as the input-file, and write to standard output by specifying - as the output-file. This enables powerful piping operations in shell scripts, allowing convert to be part of a larger processing pipeline (e.g., cat image.png | convert - -resize 50% | display -).
HISTORY
ImageMagick, and by extension convert, was first developed in 1987 by John Cristy. It quickly became a foundational tool for image processing on Unix-like systems. Version 6 of ImageMagick, often referenced by .im6 (e.g., in convert.im6), was a highly stable and widely adopted release, where convert served as the primary command-line utility for image transformation. In 2016, ImageMagick 7 introduced a significant architectural change, consolidating most functionalities under a single magick command. While convert is technically deprecated in version 7, it often remains available (e.g., as a symlink to magick) for backward compatibility with existing scripts and workflows.


