โ† Back to blog

How to Resize Images with Claude, ChatGPT, or Any AI Agent

July 7, 2026 ยท Eric ยท 5 min read

Your AI agent can resize images โ€” but only if it has a tool to call. Uploading a 4K screenshot into Claude's context wastes tokens and hits size limits. The fix: give your agent a resize-image API it can hit with one curl command.

Agent Media Tools exposes POST /api/resize-image as a free REST endpoint. No API key needed for basic use. Here's how to wire it into human workflows and autonomous agents.

Why Agents Need an Image Resize API

Common scenarios where LLMs need to resize images:

Without an API, the agent asks the human to "please resize this manually." With an API, it just does it.

Quick Start: curl (No Auth)

The fastest test โ€” resize a local image to 800px wide and save as WebP:

curl -X POST https://agentmediatools.com/api/resize-image \
  -F "image=@photo.jpg" \
  -F "width=800" \
  -F "format=webp" \
  -o resized.webp

Supported formats: JPEG, PNG, WebP, AVIF. Pass width and/or height โ€” aspect ratio is preserved if you only set one dimension.

Try it in the browser too: free online image resizer.

Python Example (Agent Script)

import requests

with open("photo.jpg", "rb") as f:
    r = requests.post(
        "https://agentmediatools.com/api/resize-image",
        files={"image": f},
        data={"width": "1200", "format": "webp"},
    )
    r.raise_for_status()
    with open("output.webp", "wb") as out:
        out.write(r.content)

Drop this into a cron job, n8n workflow, or LangChain tool โ€” same endpoint, same result.

Prompt for Claude or ChatGPT

Copy this into your agent's system prompt or a one-shot task:

Resize images by POSTing to https://agentmediatools.com/api/resize-image with multipart form data: field "image" (file), "width" (pixels), optional "format" (jpeg|png|webp|avif). No auth required. Save the binary response as the output file.

Every tool page on Agent Media Tools has a Copy Prompt button with a pre-filled version of this.

MCP Integration (Claude Desktop)

For native tool calling in Claude Desktop, install the MCP extension or add the SSE server to your config:

{
  "mcpServers": {
    "agent-media-tools": {
      "transport": "sse",
      "url": "https://agentmediatools.com/api/mcp",
      "headers": { "Authorization": "Bearer YOUR_API_KEY" }
    }
  }
}

Claude then gets resize_image as a first-class tool โ€” no curl parsing required.

Rate Limits

Batch processing and async jobs are available on Premium for overnight pipelines.

Try it now: Resize an image free ยท API docs ยท Agent hub

Related Tools


Eric builds AI tools at agentmediatools.com. More guides: blog ยท llms.txt