ImageMagick MCP: Give Your AI Assistant a Pair of Hands for Image Resizing
← Back to blog

ImageMagick MCP: Give Your AI Assistant a Pair of Hands for Image Resizing

Published on
4 mins read
--- views
ImageMagick MCP — resize and crop with a blurred background fill

AI assistants are great at deciding what an image should look like and useless at actually producing it. Ask one to "make this a 1200×630 social card" and you get a paragraph of advice instead of a file. So I built imagemagick-mcp: a tiny, fast Model Context Protocol server, written in Go, that wraps ImageMagick so any MCP-aware agent — Claude, Cursor, anything — can reframe images to exact dimensions on disk.

The whole point: give your AI assistant a pair of hands for cropping, resizing, and blur-fill backgrounds — and have it never distort the source.

The One Job It Does Well

Most image tooling either crops your subject off or squashes the aspect ratio to fit a box. This server refuses to do either. When the source already matches the target ratio, it just resizes cleanly. When it doesn't, you pick how the gap gets filled. No distortion, ever.

That's the design philosophy — one tool, three predictable modes, zero surprises:

ModeWhat you getBest for
🌫️ blur (default)Image fitted on top of a blurred, zoomed copy of itself — fills the gap beautifully, no dead spaceThumbnails, hero cards, social posts
✂️ coverCrop-to-fill, centered — no padding, no barsAvatars, tiles, fixed-grid galleries
📦 containFit inside with clean black paddingLogos, screenshots, art you can't crop

The blur mode is the one I reach for most: instead of ugly black bars or a stretched subject, you get a soft, on-brand background derived from the image itself. It's what makes a portrait photo look right in a 16:9 card.

The Tool: crop_resize_blur_bg

The server exposes a single, focused MCP tool. No sprawling API surface — just the parameters that matter:

ParameterTypeRequiredDefaultDescription
input_pathstringAbsolute path to the source image
output_pathstringAbsolute path for the output (parent dirs auto-created)
widthnumberTarget width in pixels
heightnumberTarget height in pixels
modestringblurblur, cover, or contain
blurnumber30Blur radius (used by blur mode only)

Because it takes plain absolute paths and integers, the model can drive it from a natural-language request — "resize all the photos in this folder to 1080×1080 with a blurred background" — and the agent fills in the arguments. Output directories are created automatically, so it just works.

Setup

Prerequisites

  • Go 1.22+ — to build the server
  • ImageMagick 7 — the magick binary must be on your PATH

Install ImageMagick for your platform:

# macOS
brew install imagemagick

# Windows (pick one)
choco install imagemagick
winget install ImageMagick.ImageMagick

On Windows, if you use the installer instead, tick "Add application directory to your system path".

Build

The server is a single Go binary. The Makefile covers every platform:

make build          # current platform  -> bin/imagemagick-mcp
make build-all      # cross-compile darwin/linux/windows (amd64 + arm64)
make install        # build + copy to /usr/local/bin

Wire it into your MCP client

Register the binary as a stdio server in your client's MCP config:

{
  "mcpServers": {
    "imagemagick": {
      "command": "/absolute/path/to/bin/imagemagick-mcp"
    }
  }
}

Restart the client and your assistant can start reframing images.

Why Wrap ImageMagick Instead of a Library

ImageMagick has been the gold standard for command-line image manipulation for decades — it's fast, scriptable, and already installed on half the machines that matter. Reimplementing crop-and-fill logic in a managed image library would mean reinventing battle-tested geometry math and inheriting a heavier dependency. Wrapping the magick binary keeps the server tiny and fast: it shells out to a tool that's already excellent and just teaches it to speak MCP.

That's the pattern I keep coming back to with these servers — find a mature CLI, expose exactly the operation an agent needs, and put a clean, typed interface in front of it. The model gets a reliable capability; you don't get a new attack surface or a fragile reimplementation.

The project is open on GitHub: github.com/artschekoff/imagemagick-mcp — built with Go + ImageMagick. Issues and pull requests welcome.

Open for contract collaboration

I am available for contract-based collaboration. If you have an interesting project idea, schedule a call via Calendly.

Schedule a 30-min call