Skip to main content

Documentation Index

Fetch the complete documentation index at: https://hackmamba-3f164318.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

New to ImageMagick? This page takes you from installation to your first working commands. If you already have it installed, skip to the tutorial or how-to guides.

Install ImageMagick

Install with Homebrew:
brew install imagemagick
Homebrew bundles ImageMagick with delegates for JPEG, PNG, WebP, TIFF, and other common formats. For Ghostscript font support, also run:
brew install ghostscript
MacPorts (sudo port install ImageMagick) is an alternative if you prefer it.
1

Verify the installation

Run:
magick --version
What “success” looks like: the first line must report ImageMagick 7 (not 6.9.x). You should also see a Delegates line listing codecs compiled into this binary.Example (yours will differ slightly by version, CPU, and HDRI):
Version: ImageMagick 7.1.2-21 Q16-HDRI x86_64 …
Copyright: …
License: …
Features: …
Delegates (built-in): bzlib freetype jng jpeg png tiff webp xml zlib
How to read it
  • Delegates (built-in): space-separated names (jpeg, png, webp, tiff, …) tell you which formats this build can handle without extra plug-ins. If the format you need never appears here, this binary cannot decode/encode it; you need a different install (another AppImage, Homebrew build, Docker image, or a custom compile with the right libraries).
  • If webp (or HEIC, AVIF, etc.) is missing but you need it, switch to a fuller build or follow your OS packager’s docs to add libraries and reinstall ImageMagick.
Spot-check a single format:
magick -list format | grep -i webp
You should see at least one line with WEBP and read/write flags (rw* or r-- for read-only). On Windows PowerShell, use magick -list format | Select-String -Pattern webp.
Operators vs. settings (read this once). Flags fall into two groups. Operators (-resize, -crop, -rotate, …) transform the image at the point they appear in the command line. Settings (-gravity, -quality, …) change state for the rest of the command until you override them; for example -gravity Center affects every later spatial operator, and -quality 80 sets the JPEG/WebP compression used when the output file is written (moving -quality earlier vs. later in the command usually does not change the result).
2

Convert between formats

Convert a JPEG file to PNG:
magick input.jpg output.png
ImageMagick determines both input and output formats from the file extension. That single command decodes the JPEG, then re-encodes it as PNG.
3

Resize an image

Shrink an image to fit within 800x600 pixels:
magick input.jpg -resize 800x600 output-small.jpg
The -resize operation preserves the original aspect ratio. A 1600x1200 input becomes 800x600. A 2000x1500 input becomes 800x600. A 1200x800 input becomes 800x533, because 800 is the limiting dimension at the 3:2 aspect ratio.
Add > after the dimensions to skip images that are already small enough: magick input.jpg -resize 800x600\> output-small.jpg. Without the >, a 400x300 image would be enlarged to 800x600. With it, the image stays untouched.
4

Inspect an image

Use magick identify to check an image’s format, dimensions, and file size without opening it:
magick identify input.jpg
Output:
input.jpg JPEG 1600x1200 1600x1200+0+0 8-bit sRGB 11536B 0.000u 0:00.000
Reading left to right: filename, format, dimensions, geometry, bit depth, colorspace, file size.For a cleaner view, use -format to pick the fields you want:
magick identify -format "Format: %m\nDimensions: %wx%h\nSize: %b\n" input.jpg
Output:
Format: JPEG
Dimensions: 1600x1200
Size: 11536B
5

Resize and compress in one command

Operations are processed left to right. You can stack several in one command:
magick input.jpg -resize 800x600 -quality 80 output-web.jpg
This resizes the image, then writes it as a JPEG. The -quality number controls lossy compression for the next write (lower means smaller files and usually more visible artifacts). See -quality for how to pick values across JPEG and WebP.The order of operators matters. -resize followed by -crop produces a different result than -crop followed by -resize:
# Resize to 200x200, then crop the top-left 100x100
magick input.png -resize 200x200 -crop 100x100+0+0 +repage resize-then-crop.png

# Crop the top-left 100x100, then enlarge it to 200x200
magick input.png -crop 100x100+0+0 +repage -resize 200x200 crop-then-resize.png
The first command shrinks the whole image, then extracts a piece. The second command extracts a piece first, then enlarges that piece. Different order, different output.
6

Process multiple files at once

magick mogrify overwrites matching inputs in place unless you send outputs elsewhere with -path (and usually -format). Create the destination folder first, then run mogrify, or use a shell loop with explicit output paths if you want per-file control (see the batch resize guide).
Use magick mogrify to apply the same operation to every file matching a pattern:
magick mogrify -resize 400x300 *.jpg
Safe pattern (writes into resized/ instead of overwriting sources):
mkdir resized
magick mogrify -resize 400x300 -path resized *.jpg

Keep going

You can now install, convert, resize, inspect, and batch-process images. Paths forward depend on what you need: