DEV Community

Cover image for Image Magic K : Cheat Sheet
Yellow Coder
Yellow Coder

Posted on

1

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.

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay