> ## Documentation Index
> Fetch the complete documentation index at: https://hackmamba-3f164318.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Install and First Commands

> Install ImageMagick on your platform and run your first image processing commands.

New to ImageMagick? This page takes you from installation to your first working commands. If you already have it installed, skip to the [tutorial](/tutorials/build-image-processing-pipeline) or [how-to guides](/how-to/batch-resize-and-optimize).

## Install ImageMagick

<Tabs>
  <Tab title="macOS">
    Install with [Homebrew](https://brew.sh):

    ```bash theme={null}
    brew install imagemagick
    ```

    Homebrew bundles ImageMagick with delegates for JPEG, PNG, WebP, TIFF, and other common formats. For Ghostscript font support, also run:

    ```bash theme={null}
    brew install ghostscript
    ```

    [MacPorts](https://www.macports.org/) (`sudo port install ImageMagick`) is an alternative if you prefer it.
  </Tab>

  <Tab title="Linux">
    For a **known ImageMagick 7** CLI on Linux, use the **official AppImage** from [ImageMagick on GitHub Releases](https://github.com/ImageMagick/ImageMagick/releases).

    **Fast path (Intel/AMD x86\_64):** run this as-is when the asset still exists. If `wget` returns **404**, the release was rotated; use the “Any CPU / any 7.x release” steps below.

    ```bash theme={null}
    wget -O magick-appimage "https://github.com/ImageMagick/ImageMagick/releases/download/7.1.2-21/ImageMagick-7.1.2-21-gcc-x86_64.AppImage"
    chmod +x magick-appimage
    sudo mv magick-appimage /usr/local/bin/magick
    magick --version
    ```

    **Any CPU / any 7.x release:** open the [releases page](https://github.com/ImageMagick/ImageMagick/releases), pick a **7.x** release, expand **Assets**, find the `.AppImage` for your architecture (`ImageMagick-*-gcc-x86_64.AppImage` on Intel/AMD, or the arm64 build on ARM). Copy its URL (in most browsers: **right-click the file name → Copy link address**). Paste that URL into the quotes in the next command. Nothing else in the line should be edited.

    ```bash theme={null}
    wget -O magick-appimage "PUT_THE_GITHUB_ASSET_URL_YOU_COPIED_HERE"
    chmod +x magick-appimage
    sudo mv magick-appimage /usr/local/bin/magick
    magick --version
    ```

    Distribution packages (`apt install imagemagick`, and similar) often install **version 6** or ship **7** without the delegates you expect. Treat the AppImage (or the [official Linux download page](https://imagemagick.org/script/download.php#linux)) as the path to a predictable **v7** `magick` binary.
  </Tab>

  <Tab title="Windows">
    Download the installer from the [ImageMagick releases page](https://imagemagick.org/script/download.php#windows). Choose the **Q16** variant (16 bits per channel) for most use cases.

    Run the installer and check **"Add application directory to your system path"** when prompted. This lets you run `magick` from any command prompt or PowerShell window.
  </Tab>

  <Tab title="Docker">
    ImageMagick does not publish an official Docker image. The community-maintained [`dpokidov/imagemagick`](https://hub.docker.com/r/dpokidov/imagemagick) image provides ImageMagick 7 with broad format support and is widely used. From their documentation:

    ```bash theme={null}
    docker run --rm -v "$(pwd)":/imgs dpokidov/imagemagick /imgs/input.jpg -resize 800x600 /imgs/output-resized.jpg
    ```

    This mounts your current directory into the container, processes the image, and writes the output back to your filesystem. See the [Docker Hub page](https://hub.docker.com/r/dpokidov/imagemagick) for additional usage examples and available tags.
  </Tab>
</Tabs>

<Steps>
  <Step title="Verify the installation">
    Run:

    ```bash theme={null}
    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:

    ```bash theme={null}
    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`.

    <Info>
      **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).
    </Info>
  </Step>

  <Step title="Convert between formats">
    Convert a JPEG file to PNG:

    ```bash theme={null}
    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.
  </Step>

  <Step title="Resize an image">
    Shrink an image to fit within 800x600 pixels:

    ```bash theme={null}
    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.

    <Tip>
      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.
    </Tip>
  </Step>

  <Step title="Inspect an image">
    Use `magick identify` to check an image's format, dimensions, and file size without opening it:

    ```bash theme={null}
    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:

    ```bash theme={null}
    magick identify -format "Format: %m\nDimensions: %wx%h\nSize: %b\n" input.jpg
    ```

    Output:

    ```
    Format: JPEG
    Dimensions: 1600x1200
    Size: 11536B
    ```
  </Step>

  <Step title="Resize and compress in one command">
    Operations are processed left to right. You can stack several in one command:

    ```bash theme={null}
    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](/reference/common-options#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`:

    ```bash theme={null}
    # 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.
  </Step>

  <Step title="Process multiple files at once">
    <Warning>
      **`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](/how-to/batch-resize-and-optimize)).
    </Warning>

    Use `magick mogrify` to apply the same operation to every file matching a pattern:

    ```bash theme={null}
    magick mogrify -resize 400x300 *.jpg
    ```

    Safe pattern (writes into `resized/` instead of overwriting sources):

    ```bash theme={null}
    mkdir resized
    magick mogrify -resize 400x300 -path resized *.jpg
    ```
  </Step>
</Steps>

## Keep going

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

* **[Build an image processing pipeline](/tutorials/build-image-processing-pipeline)** walks you through combining resize, metadata stripping, watermarking, and format conversion into a reusable workflow.
* **[Batch resize and optimize for web](/how-to/batch-resize-and-optimize)** covers real-world batch processing with quality control and file size constraints.
* **[Geometry syntax reference](/reference/geometry)** explains the modifiers (`>`, `<`, `!`, `^`) you can append to dimension strings.
* **[Common options reference](/reference/common-options)** documents `-strip`, `-quality`, `-auto-orient`, `-gravity`, `-background`, and `-composite` in one place.
* **[Troubleshooting](/troubleshooting)** if install or first commands fail (`magick` not found, missing delegates, policy errors, or shell escaping around `>` in geometry).
