DEV Community

Cover image for Image Magic K : Cheat Sheet
Shubham Lodhi
Shubham Lodhi

Posted on

Image Magic K : Cheat Sheet

ImageMagick is a powerful tool for image manipulation. This cheat sheet provides a quick reference to common commands and their purposes.

Table of Contents

  1. Basic Commands
  2. Image Conversion
  3. Image Transformation
  4. Image Effects
  5. Text and Drawing

Basic Commands

Command Purpose
magick Main command to invoke ImageMagick.
magick identify Display image information.
magick convert Convert images from one format to another.
magick mogrify Batch process images.

Image Conversion

Command Purpose
magick input.png output.jpg Convert PNG to JPG.
magick input.tiff output.png Convert TIFF to PNG.
magick input.gif output.webp Convert GIF to WebP.

Image Transformation

Command Purpose
magick input.jpg -resize 800x600 output.jpg Resize image to 800x600.
magick input.jpg -rotate 90 output.jpg Rotate image by 90 degrees.
magick input.jpg -crop 100x100+10+10 output.jpg Crop image to 100x100 starting at (10,10).

Image Effects

Command Purpose
magick input.jpg -blur 0x8 output.jpg Apply blur effect.
magick input.jpg -sharpen 0x3 output.jpg Sharpen the image.
magick input.jpg -sepia-tone 80% output.jpg Apply sepia tone effect.

Text and Drawing

Command Purpose
magick input.jpg -gravity center -pointsize 36 -draw "text 0,0 'Sample Text'" output.jpg Add centered text to image.
magick input.jpg -fill blue -draw "rectangle 10,10 100,100" output.jpg Draw a blue rectangle.


Conclusion

This cheat sheet provides a quick reference to common ImageMagick commands. For more detailed information, refer to the official documentation.

Top comments (0)