convert
image manipulation and format conversion
TLDR
Convert image format
SYNOPSIS
convert [options] input output
DESCRIPTION
convert is the primary command-line interface for ImageMagick, one of the most versatile image processing tools available. It supports over 200 image formats and can perform virtually any image transformation including format conversion, resizing, rotation, cropping, color manipulation, and applying artistic effects.
The tool operates by reading one or more input images, applying a series of transformations specified by command-line options, and writing the result to an output file. Multiple operations can be chained together in a single command, with operations applied in the order specified.
convert is widely used in web development for generating thumbnails, in photography workflows for batch processing, and in scientific computing for image analysis. Its scriptable nature makes it ideal for automation, though complex operations can consume significant memory and CPU time. In ImageMagick 7+, the command is being replaced by the unified magick command, though convert remains available for compatibility.
PARAMETERS
-resize geometry
Resize image (e.g., 50%, 800x600, 800x)-rotate degrees
Rotate image-crop geometry
Crop image-quality value
Compression quality (1-100)-scale geometry
Scale image (faster, lower quality)-thumbnail geometry
Create thumbnail-blur radius
Blur image-sharpen radius
Sharpen image-negate
Invert colors-monochrome
Convert to black and white-flip
Flip vertically-flop
Flip horizontally
GEOMETRY SPECIFICATIONS
- 800x600 - Maximum dimensions (keep aspect)
- 800x600! - Exact dimensions (ignore aspect)
- 800x600^ - Minimum dimensions (crop)
- 50% - Percentage scale
- 800x - Width (calculate height)
- x600 - Height (calculate width)
WORKFLOW
convert photo.png photo.jpg
# Resize maintaining aspect ratio
convert input.jpg -resize 800x600 output.jpg
# Exact size (may distort)
convert input.jpg -resize 800x600! output.jpg
# Resize by percentage
convert input.jpg -resize 50% output.jpg
# Thumbnail
convert input.jpg -thumbnail 200x200 thumb.jpg
# Rotate
convert input.jpg -rotate 90 output.jpg
# Crop (width x height + x_offset + y_offset)
convert input.jpg -crop 800x600+100+100 output.jpg
# Quality compression
convert input.jpg -quality 85 output.jpg
# Multiple operations
convert input.jpg -resize 800x600 -rotate 90 -quality 90 output.jpg
BATCH OPERATIONS
for img in *.png; do
convert "$img" "${img%.png}.jpg"
done
# Resize all images
for img in *.jpg; do
convert "$img" -resize 800x600 "resized_$img"
done
EFFECTS
convert input.jpg -blur 0x8 output.jpg
# Sharpen
convert input.jpg -sharpen 0x1 output.jpg
# Border
convert input.jpg -border 5x5 -bordercolor black output.jpg
# Add text
convert input.jpg -pointsize 36 -fill white \
-annotate +50+50 'Hello' output.jpg
CAVEATS
Large images consume memory. Complex operations can be slow. Default quality settings may reduce file size significantly. Some operations change aspect ratio. Security vulnerabilities in old versions. Consider using `magick` command (ImageMagick 7+).
HISTORY
convert is part of ImageMagick, created by John Cristy in 1987, becoming one of the most versatile image manipulation tools.
