Skip to main content
Agent skill

Image Resize

Resizes a single image to explicit width and height using ImageMagick. Use when the user wants image resize, scale a sprite/texture, resize a UI asset or icon, or mentions ImageMagick resize — target size must be specified before running.

Get started

Get the complete skill folder, including its scripts and reference files.

When to use this skill

Use Image Resize when an AI agent needs a reusable SKILL.md workflow for this job: Resizes a single image to explicit width and height using ImageMagick. Use when the user wants image resize, scale a sprite/texture, resize a UI asset or icon, or mentions ImageMagick resize — target size must be specified before running.

When not to use it

Skip Image Resize when the task is outside the productivity category, or when a more specific skill in this directory already covers the same workflow with clearer triggers.

How to install

Where will you use it?

Install scope
Claude Code folder setup
mkdir -p ~/.claude/skills/image-resize
# Save SKILL.md to ~/.claude/skills/image-resize/SKILL.md
  1. Claude Code personal install: place the skill and its bundled files at ~/.claude/skills/image-resize/SKILL.md. For a shared project, commit the folder at .claude/skills/image-resize/ instead.
  2. Current Claude Code detects SKILL.md changes in watched directories during the session. If you just created a top-level skills directory, run /reload-skills. Check that the skill is listed before testing its trigger.
  3. For Claude chat or Cowork in the Desktop app, manage uploaded skills in Customize > Skills; copying files into a local Claude Code folder is not a Desktop install. Other agents may use different install locations.

Full install guide for Claude, Cursor, and Codex →

Try a starter prompt

After installing the skill, paste this starter prompt into your agent to verify it triggers on a small task.

Starter prompt
Use the Image Resize skill for this task: Use Image Resize when this documented workflow matches the task. Confirm any required inputs or files before making changes.

What supports this recommendation?

70/100 provisional content score. This measures documentation, practical detail and source signals. It is not a measured task success rate or a security certification.

Documentation
77/100
Practical detail
68/100
Source evidence
61/100
Source signals
72/100
Model compatibility evidence
  • claudeuntested

    No model-specific signal or recorded compatibility test was found.

  • chatgptuntested

    No model-specific signal or recorded compatibility test was found.

  • geminiuntested

    No model-specific signal or recorded compatibility test was found.

  • copilotuntested

    No model-specific signal or recorded compatibility test was found.

  • llamauntested

    No model-specific signal or recorded compatibility test was found.

  • perplexityuntested

    No model-specific signal or recorded compatibility test was found.

  • mistraluntested

    No model-specific signal or recorded compatibility test was found.

  • grokuntested

    No model-specific signal or recorded compatibility test was found.

Inferred compatibility is based on content signals. Check the app, its available tools and setup requirements before running a skill.

What this skill does

# Image Resize

Resize **one image file** to a **user-specified width and height** via **ImageMagick**. **Both dimensions are required** — do not run this skill until the user (or task) provides target pixel size.

## Rules

When this skill applies, read and follow [skill-dependency-manager](../skill-dependency-manager.md) — run scripts as documented, install missing tools into `.dependency/`.

- **Require target size first.** If width/height are missing, ask the user before running. - **Single file only.** Pass one image with `--image`; directories are not supported. - Run `resize.py` through the bundled script — do not hand-write `magick -resize` commands. - **Never overwrite source files.** Output goes to `image-resize/` (or `--output`) by default. - `populated: false` for `imagemagick` is not a reason to skip. Install first, set `populated: true`, retry the same command.

## Setup (first run)

1. Download ImageMagick portable build from [imagemagick.org](https://imagemagick.org/script/download.php) and extract to `.dependency/imagemagick/`.

Windows result example: `.dependency/imagemagick/magick.exe`

2. Register in `.dependency/manifest.json`:

```json "imagemagick": { "populated": true, "bin": ".dependency/imagemagick/magick.exe" } ```

Use `bin/magick` on Unix (no `.exe`).

## Quick Start

**Both `--width` and `--height` are required:**

```bash .dependency/python/python .ai/image-resize/resize.py --image assets/sprites/hero.png --width 128 --height 128 ```

Example: `assets/ui/icon.png` → `assets/ui/image-resize/icon.png` at 64×64

Custom output path:

```bash .dependency/python/python .ai/image-resize/resize.py --image assets/icons/badge.png -o assets/icons_64 --width 64 --height 64 ```

## Resize Modes

| Mode | Flag | Behavior | |------|------|----------| | `fit` *(default)* | `--mode fit` | Fit inside WxH, preserve aspect ratio (letterbox area unused) | | `fill` | `--mode fill` | Cover WxH, center-crop overflow | | `exact` | `--mode exact` | Force WxH, ignore aspect ratio |

```bash # Fit within 128×128 (default — no distortion) .dependency/python/python .ai/image-resize/resize.py --image assets/hero.png --width 128 --height 128

# Cover 128×128, crop center .dependency/python/python .ai/image-resize/resize.py --image assets/hero.png --width 128 --height 128 --mode fill

# Stretch to exactly 128×128 .dependency/python/python .ai/image-resize/resize.py --image assets/hero.png --width 128 --height 128 --mode exact ```

## Defaults

| Option | Default | Notes | |--------|---------|-------| | `--image` | **Required** | Single supported image file | | `--width` / `--height` | **Required** | Must be positive integers | | `--mode` | `fit` | `fill` or `exact` when user needs crop or stretch | | Output | `<source-dir>/image-resize/<source-name>` | Use `--output` for custom file or directory | | Format | Same as source | Extension preserved (`.png`, `.jpg`, etc.) |

Supported inputs: `.jpg`, `.jpeg`, `.png`, `.webp`, `.gif`, `.bmp`, `.tif`, `.tiff`, `.avif`, `.ico`.

## Agent Workflow

1. **Confirm size** — get explicit width and height from the user (e.g. "128×128", "64 wide and 64 tall"). Do not guess from context unless the user already stated dimensions. 2. **Pick mode** — default `fit`; use `fill` for square thumbnails from non-square art; use `exact` only when the user accepts distortion. 3. **One file per run** — resize one image, verify dimensions, then repeat for additional files if needed. 4. **Paths** — pass whatever image path the user gives; output lands in `image-resize/` next to that file by default. 5. **Revert** — delete output file or `git restore`; sources are never modified.

## Agent Notes

1. Use the bundled script, not hand-written ImageMagick commands. 2. Missing Python/ImageMagick → populate `.dependency/` per skill-dependency-manager, retry same command. 3. **Do not copy, move, or replace the source with resized output** — tell the user where the output file is. 4. Need **format conversion only** (no resize) → [image-to-png](../image-to-png/SKILL.md). 5. Need **trim borders** after resize → [image-trim](../image-trim/SKILL.md).

## Troubleshooting

| Issue | Fix | |-------|-----| | `imagemagick` missing in manifest | Follow **Setup**; update manifest | | Missing `--width` / `--height` | Ask user for target size; both flags are required | | Directory passed to `--image` | Run once per file; this skill accepts image files only | | Output larger/smaller than expected | Check `--mode` — `fit` preserves aspect inside the box | | Distorted sprite | Switch from `exact` to `fit` or `fill` | | Animated GIF | Only first frame is processed by default ImageMagick behavior |

## CLI

Copy-paste commands: [cli/image-resize.md](../../../cli/image-resize.md)

Intended uses

  • Use Image Resize when this documented workflow matches the task.

Implementation notes

  • Review the source instructions and adapt inputs before running the workflow.

Try it, then tell us how it went

A copied prompt does not tell us whether the task worked. Report your result after checking the output. We collect your tool and outcome, never your files or prompt.