zs3.me

ImageMagick Quick Reference

Revision 2
© 2021,2023 by Zack Smith. All rights reserved.

What is ImageMagick?

ImageMagick is the Swiss Army Knife of image conversion and manipulation. It can't do everything, but it can do quite a lot. It is very much a manually-operated utility and requires knowing various parameters to achieve the best image output.

Useful commands

Strip metadata from your image

 convert photograph.jpg -strip output.png

Convert photo to grayscale

 convert photograph.jpg -Colorspace gray output.png

Color negative

 convert photograph.png -channel RGB -negate output.png

Flip an image horizontally

 convert photograph.png -flop output.png

Flip an image vertically

 convert photograph.png -flip output.png

Rotate an image

 convert photograph.png -rotate 90 output.png

Swap color channels

  • 0 = red channel
  • 1 = green channel
  • 2 = blue channel

To swap green and blue channels, it is:

 convert image.png -separate +channel -swap 1,2 -combine -colorspace sRGB output.png

Links

771523904