Skip to content

Instantly share code, notes, and snippets.

@oxguy3
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oxguy3/b73fd0e5abd655ec56a9 to your computer and use it in GitHub Desktop.
Save oxguy3/b73fd0e5abd655ec56a9 to your computer and use it in GitHub Desktop.
A list of useful commands with ImageMagick

ImageMagick commands reference

Most basic usage (convert file type)

convert SRC DEST
convert -format FORMAT SRC DEST # explicitly define type instead of relying on extensions

Basic functions

Resize image

convert -resize 50% SRC DEST    # by percentage
convert -resize 64x64 SRC DEST  # to precise dimensions
convert -resize 64 SRC DEST     # fit to set height
convert -resize x64 SRC DEST    # fit to set width

Rotate image (by degrees)

convert -rotate -90 SRC DEST

Negate colors (invert)

convert -negate SRC DEST

Difference between two images

composite SRC1 SRC2 -compose difference DEST

Complex uses

Compress a jpg (good quality/size tradeoff)

convert -strip -interlace Plane -gaussian-blur 0.05 -quality 85% SRC DEST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment