ImageMagick is a suite of command-line tools for creating, editing, compositing, and converting images. It supports 200+ formats including PNG, JPEG, GIF, TIFF, WebP, PDF, SVG, and many more.
Note: In ImageMagick 7+, use magick instead of the individual command names, or prefix them: magick convert, magick mogrify, etc.
| convert | Convert between formats and apply transformations. Takes one or more inputs and writes to a new output file. The Swiss Army knife of IM. |
| mogrify | Like convert but edits files in-place (overwrites originals). Great for batch processing a directory. |
| composite | Overlay/composite one image over another. Specify gravity, geometry, and compositing operator. |
| montage | Create a grid/contact sheet from multiple images. Controls tile layout, borders, labels. |
| identify | Print format and characteristics of an image: size, format, colorspace, bit depth, etc. |
Option order matters. Operations in convert/mogrify apply sequentially to the image. -resize then -crop is different from -crop then -resize.
Geometry syntax: WxH (fit), WxH! (force exact), WxH> (only shrink), WxH< (only enlarge), WxH^ (fill, may crop). +X+Y for offsets.
Percentages: Many geometry args accept % values: -resize 50% halves each dimension.
| -resize WxH | Resize image. Preserves aspect ratio unless ! is used. E.g. -resize 800x600, -resize 50%, -resize 800x. |
| -crop WxH+X+Y | Crop a region. -crop 200x200+50+50 takes 200×200 starting at (50,50). Use -crop WxH+0+0 +repage to strip canvas offset after crop. |
| -rotate deg | Rotate clockwise. Non-90° angles add a background fill (see -background -flatten). |
| -flip / -flop | Flip vertically (-flip) or horizontally (-flop, mirror). |
| -thumbnail WxH | Like -resize but strips metadata and is optimized for thumbnails (faster). |
| -gravity type | Sets anchor point for subsequent ops: NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast. |
| -extent WxH | Set canvas size without scaling. Pads or crops based on -gravity. Good for adding letterbox/padding. |
| -quality N | JPEG/WebP: 1–100 (higher = better). PNG: 0–9 (compression level). Default JPEG quality is 92. |
| -colorspace | Convert colorspace: sRGB, Gray, CMYK, HSL, etc. Use -colorspace Gray for grayscale. |
| -brightness-contrast | Adjust brightness/contrast: -brightness-contrast 10x20 (brightness 10, contrast 20). Range: -100 to +100. |
| -modulate B,S,H | Adjust brightness, saturation, hue as percentages: -modulate 110,130,100. |
| -normalize | Auto-stretch contrast to use full range. |
| -auto-level | Auto-normalize per channel (stronger than -normalize). |
| -gamma N | Apply gamma correction. <1 darkens, >1 lightens. |
| -draw | Draw primitives: rectangle, circle, line, text. E.g. -draw "circle 100,100 150,100". |
| -annotate deg text | Draw text at angle. Works with -font, -pointsize, -fill, -gravity. |
| -composite | Composite a second image. Control with -compose operator: Over, Multiply, Screen, etc. |
| -watermark | Blend watermark at a given opacity percentage. |
• +repage after -crop resets the virtual canvas offset — usually needed.
• -strip removes all metadata (EXIF, ICC, comments) — good for web images.
• -interlace Plane makes progressive JPEGs for faster web loading.
• mogrify -path output/ -format jpg *.png batch converts without overwriting originals.
• Use identify -verbose image.jpg to dump all metadata.
• Parentheses ( ) (escaped as \( \) in shell) create sub-image stacks for complex compositing.
This is an educational tool. The commands it builds are real — they will do exactly what you tell them to. Some flags are destructive (deletion, overwriting, forced operations) and even non-destructive options can cause data loss or system trouble in the wrong circumstances.
• Always review the generated command before running it.
• Test on disposable files and directories first.
• If you do not understand what a flag does, look it up in the official manual page (man command).
• Be careful processing untrusted files. ImageMagick reads many formats including PDF and SVG, and historically has had remote code execution vulnerabilities (e.g. "ImageTragick", CVE-2016-3714) when fed crafted files. Keep ImageMagick up to date, and avoid running it casually on files from unknown sources, especially on poorly maintained systems.
The author of these pages is not responsible for any damage, data loss, or other consequences resulting from commands generated, copied, or run from this site. Use at your own risk.
⚠ These tools build real shell commands. Review every command before running it. The author is not responsible for any damage, data loss, or other consequences resulting from commands generated, copied, or run from this site. Use at your own risk.
Send comments and bug reports to chris@chrisspackman.com.
Version 0.3.0 — Last updated: 2026-05-26
This page is Copyright © 2026
Chris Spackman <chris@chrisspackman.com>.
This web site developed entirely on GNU/Linux with Free / Open Source Software.
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.