resize-image

Resize images using ImageMagick when they are too large to view or process. Use this skill when you encounter an image file that exceeds token limits, is too large to read, or when you need to create a smaller version of an image for viewing.

⭐5stars🔀1forks📁View on GitHub🕐Updated Jan 11, 2026⬇️1downloads

When & Why to Use This Skill

This Claude skill provides a robust solution for image optimization and manipulation using ImageMagick. It enables AI agents to resize, compress, and reformat images that are too large for standard processing or viewing, effectively overcoming LLM token limits and improving the efficiency of visual data analysis in agentic workflows.

Use Cases

  • Bypassing token limits: Resize high-resolution mockups, screenshots, or diagrams so they can be successfully read and analyzed by AI models without exceeding context constraints.
  • Automated thumbnail generation: Create smaller preview versions of images for web galleries, documentation, or UI components while maintaining aspect ratios.
  • Batch image processing: Standardize dimensions and file sizes across multiple images in a directory for consistent storage and presentation.
  • File size optimization: Reduce image quality or color depth (e.g., converting to 256 colors) to minimize storage overhead and speed up file transmission.
nameresize-image
descriptionResize images using ImageMagick when they are too large to view or process. Use this skill when you encounter an image file that exceeds token limits, is too large to read, or when you need to create a smaller version of an image for viewing.
allowed-toolsBash, Read

Resize Image Skill

This skill allows you to resize images using ImageMagick's convert command when they are too large to view or process.

When to Use

  • When reading an image file fails due to token limits
  • When an image is too large to process
  • When you need to create a thumbnail or smaller version of an image
  • When a user provides a mockup or screenshot that's too large

Prerequisites

ImageMagick must be installed. Check with:

which convert || echo "ImageMagick not installed"

If not installed, suggest the user install it:

  • Ubuntu/Debian: sudo apt-get install imagemagick
  • macOS: brew install imagemagick

Instructions

Step 1: Check the original image size

identify "/path/to/image.png"

This shows dimensions and file size.

Step 2: Resize the image

Resize to a maximum width/height while maintaining aspect ratio:

convert "/path/to/original.png" -resize 800x600\> "/tmp/resized-image.png"

The \> flag ensures the image is only shrunk, never enlarged.

Common resize options:

  • -resize 800x600 - Fit within 800x600, maintain aspect ratio
  • -resize 50% - Scale to 50% of original size
  • -resize 400x - Set width to 400px, auto-calculate height
  • -resize x400 - Set height to 400px, auto-calculate width

Step 3: Reduce quality/colors for smaller file size (optional)

For PNG files, reduce colors:

convert "/path/to/original.png" -resize 800x600\> -colors 256 "/tmp/resized-image.png"

For JPEG files, reduce quality:

convert "/path/to/original.jpg" -resize 800x600\> -quality 80 "/tmp/resized-image.jpg"

Step 4: Read the resized image

# Verify the new size
ls -la /tmp/resized-image.png
identify /tmp/resized-image.png

Then use the Read tool to view the resized image:

Read /tmp/resized-image.png

Examples

Example 1: Resize a large mockup

# Check original size
identify "/mnt/c/Users/user/mockup.png"
# Output: mockup.png PNG 2400x1800 ...

# Resize to fit within 800x600
convert "/mnt/c/Users/user/mockup.png" -resize 800x600\> "/tmp/mockup-small.png"

# Verify
identify "/tmp/mockup-small.png"
# Output: mockup-small.png PNG 800x600 ...

Example 2: Create a thumbnail

convert "/path/to/screenshot.png" -resize 400x -colors 128 "/tmp/thumbnail.png"

Example 3: Batch resize multiple images

for img in /path/to/images/*.png; do
  convert "$img" -resize 800x600\> "/tmp/$(basename "$img")"
done

Output Location

Always save resized images to /tmp/ with a descriptive name:

  • /tmp/resized-mockup.png
  • /tmp/thumbnail-screenshot.png
  • /tmp/small-diagram.png

Troubleshooting

"convert: command not found" ImageMagick is not installed. Ask the user to install it.

"convert: unable to open image" Check the file path. Windows paths under WSL should use /mnt/c/... format.

Image still too large after resize Try reducing colors or quality, or resize to smaller dimensions.