How to ... in Image Magick (in examples)

Assembled by Ross Bannister, University of Reading

Image processing with ImageMagick

Make a white background transparent

convert image-file -transparent white output-file.png
convert image-file -transparent -fuzz 50% white output-file.png

Resize an image

convert image-file -resize axb\! output-file     #(ignore aspect ratio of input-file)
convert image-file -resize axb output-file       #(preserve aspect ratio)

Rotate an image

convert image-file -rotate angle output-file

Crop

convert image-file -crop DeltaaxDeltab+a0+b0 output-file
convert image-file -trim output-file     #(auto crop)

Make an animation from existing frames

convert -delay time-in-cs -loop number-of-loops input*.gif output.gif

Invert colours in an image

convert image-file -negate output-file

Make a high-quality JPEG from an eps

convert -density 900 image-file.eps -resize 1024x1024 output-file.jpg

Make a high-quality JPEG from a pdf

convert -density 150 -trim input.pdf -quality 100 -flatten -sharpen 0x1.0 output.jpg