DevTools Logo

ImageMagick Command Builder

ImageMagick Command Builder

Compose IM7 magick / IM6 convert commands with every flag explained line by line.

Runs in your browser
Try an example

Operation model

4 operation(s)
Resize geometry

Resize only when the source is larger than the box.

Sample 1920×1080 → 1600×900

Command

4 flag(s)

Command

magick photo.jpg -auto-orient -resize '1600x>' -quality 85 -strip out.jpg

Flag explanations

  1. -auto-orient

    Apply EXIF orientation first, so later rotation starts from the upright image.

  2. -resize

    Resize to 1600px wide; the height follows the source aspect ratio.

  3. -quality

    Set JPEG/MIFF quality to 85; higher values keep more detail at a larger size.

  4. -strip

    Remove EXIF, IPTC, XMP and comments before writing the output.

Details

Pick your operations and get a copy-ready ImageMagick command with the flags in the correct order: EXIF auto-orientation before rotation, resize geometry with the right modifier, colorspace, quality and metadata stripping before the output path. Every emitted flag has a plain-language explanation generated from the same model that compiled it. Paths with spaces are quoted safely, a mogrify batch variant is offered when the operations are in-place safe, and a dimension preview approximates the geometry. No image is processed or uploaded.

More examples

Responsive web hero

magick photo.jpg -auto-orient -resize 1600x\> -quality 85 -strip out.jpg

EXIF orientation is applied first, the width-only shrink keeps the original aspect ratio, then quality and metadata handling finish the command.

Cover thumbnail

magick photo.jpg -resize 320x320^ -gravity center -extent 320x320 -quality 82 -strip out.jpg

The ^ modifier scales to cover the box; gravity and extent center-crop exactly to 320×320.

Legacy ImageMagick 6

convert photo.png -resize 800x -colorspace Gray out.png

The IM6 toggle swaps the binary prefix and shows a deprecation note; flag order is unchanged.

Examples

Shrink a hero image

Input
photo.jpg → 1600x>
Output
magick photo.jpg -auto-orient -resize 1600x> -quality 85 -strip out.jpg

Auto-orientation runs first; the shrink-only guard keeps small originals untouched.

Square thumbnail

Input
photo.jpg → 320x320^
Output
magick photo.jpg -resize 320x320^ -gravity center -extent 320x320 out.jpg

Cover mode plus extent produces an exact square without letterboxing.

Batch convert

Input
mogrify-safe operations
Output
magick mogrify -path build -resize 800x -quality 80 -strip 'photo.jpg'

The in-place variant is only offered for resize, quality and strip.

About this tool

ImageMagick Command Builder turns a small operation model into a correct `magick` (IM7) or `convert` (IM6) invocation. It compiles resize geometry, rotation, auto-orientation, colorspace, quality, flips and metadata stripping in a fixed flag order, with shell-safe quoting for paths containing spaces.

Each emitted flag is explained by the same model that produced it, so the explanation cannot drift from the command. Geometry modifiers are described in plain language: `>` shrinks only, `<` enlarges only, `!` forces exact dimensions and `^` covers the box before a centered `-extent` crop.

The tool emits commands for server-side execution — it does not process images in your browser. A dimension preview approximates the geometry of a 1920×1080 sample, and a `mogrify` batch variant is offered only when every operation is safe to apply in place.

What this tool does not do

  • This tool emits commands; it never processes, uploads or previews real image pixels.
  • The dimension readout approximates a 1920×1080 sample and does not read an uploaded file.
  • Commands target POSIX shells; single-quote escaping is POSIX-style, not Windows cmd.exe syntax.
  • Advanced IM features (masks, channels, -pipeline chains and procedural options) are out of scope.
  • Version-specific behaviour can differ between IM6 and IM7; check the warnings and test on your server.

How to use this tool

  1. Set paths

    Enter the input and output paths. Values with spaces are quoted automatically; paths are never concatenated unquoted into the command.

  2. Choose a version

    Use magick for ImageMagick 7 or convert for IM6. The IM6 choice adds a deprecation note.

  3. Describe the resize

    Set width, optional height and a modifier. The help line and sample dimension preview explain what the geometry will do.

  4. Add operations

    Set rotation and quality, then toggle auto-orient, grayscale, flip, flop and strip. Flag order is enforced by the compiler no matter how you fill the form.

  5. Copy the command

    Copy the command or download it as a shell script. Review the warnings (for example PNG quality semantics) before running it on the server.

Use cases

CI image optimisation

Generate the exact resize-and-strip command for a build pipeline without memorising flag order.

Upload handling

Prepare a server-side command that normalises EXIF orientation before resizing user photos.

Documentation snippets

Produce copy-ready IM6/IM7 variants with per-flag prose for a technical article.

Batch jobs

Use the mogrify variant for folders of images when only in-place-safe operations are needed.

Geometry modifiers

FlagMeaning
1600xWidth 1600px, height follows the aspect ratio
1600x1200Fit inside a 1600×1200 box, preserving aspect ratio
1600x1200!Force exactly 1600×1200, distortion allowed
1600x1200>Shrink only; smaller images are left alone
1600x1200<Enlarge only; larger images are left alone
1600x1200^Cover the box, then -gravity center -extent crops the overflow

Resize geometry is pixel-based; JPEG quality is 1–100.

Common mistakes

Mistake:Rotating before applying EXIF orientation.

Fix:The compiler always puts -auto-orient before -rotate; EXIF-tagged phones otherwise produce sideways images.

Mistake:Expecting ^ alone to produce exact dimensions.

Fix:Cover mode scales past the box; the compiler adds -gravity center -extent to crop it to the requested size.

Mistake:Treating PNG -quality like JPEG quality.

Fix:For PNG it maps to zlib compression level (90–95 is roughly level 9); the tool warns when a PNG output has quality set.

Mistake:Running mogrify with destructive operations.

Fix:The batch variant is only emitted for resize, quality and strip; rotations and flips stay in single-file commands.

Mistake:Forgetting that paths with spaces need quoting.

Fix:The compiler shell-quotes any path containing non-unreserved characters, including apostrophes.

Frequently asked questions

What is the difference between magick and convert?

ImageMagick 7 introduced the `magick` command as the unified entry point. IM6 used `convert`, and although IM7 may still accept it, it can resolve to a different tool on some systems. The version toggle changes the prefix and adds a deprecation note for IM6; every other flag stays the same.

What do > and ^ mean in -resize?

`>` means shrink only: an image smaller than the requested box is left at its original size. `^` means cover: the image is scaled so it fills the whole box, possibly overflowing it. The builder pairs `^` with `-gravity center -extent WxH` so the final image is exactly the requested size.

Why is -auto-orient placed before -rotate?

EXIF orientation describes how a camera sensor image should be displayed. Applying that orientation first means a subsequent -rotate starts from the upright image; reversing the two order produces sideways results for many phone photos. The compiler enforces this order.

How does -quality behave for JPEG versus PNG?

For JPEG, -quality is a lossy scale from 1 to 100 and 85 is a common web compromise. For PNG it is a compression-level mapping (90–95 corresponds roughly to zlib level 9), not lossy quality. The builder shows a contextual warning when your output is a PNG and quality is set.

How do I strip metadata?

Turn on Strip metadata. The compiler emits -strip immediately before the output path, removing EXIF, IPTC, XMP and comments. It cannot be simulated in the dimension preview — the explanation marks it as a server-side-only operation.

Is my image uploaded or processed here?

No. This tool only composes command text. It does not accept image uploads, run ImageMagick, or send anything over the network; the preview is a dimension calculation for a fixed sample size.

References & standards