How to resize an image from a URL with an API

Updated 2026-11-10

Use when an image must be scaled to given dimensions, keeping or ignoring its aspect ratio. Add output=url for a 24 h link.

From an MCP client, add https://tanod.dev/mcp and call image_resize; its free daily calls are applied automatically, no key or signup.

POST an image URL and a size to /v1/image/resize. It returns the resized image as base64 with its format, width, height and byte size.

Request

Set width and/or height, or scale. fit is inside (default), contain (letterboxed on background), cover (centre crop) or fill (stretched). resample defaults to Lanczos. format and quality (1 to 100) control the output. Input is a public image URL (up to 10 MB) or image_base64 (up to 10 MB decoded; a data:image/...;base64, prefix is fine).

curl, using the free tier
curl -s -X POST https://tanod.dev/v1/image/resize \
  -H 'X-Tanod-Free: 1' -H 'content-type: application/json' \
  -d '{"url": "https://tanod.dev/icon.png", "width": 64}'

The file comes back as base64 in the JSON. To save it, pipe the response through jq and base64:

save the result to a file
curl -s -X POST https://tanod.dev/v1/image/resize \
  -H 'X-Tanod-Free: 1' -H 'content-type: application/json' \
  -d '{"url": "https://tanod.dev/icon.png", "width": 64}' \
  | jq -r '.data_base64' | base64 -d > resized.png

Response

Response (example from the API spec, trimmed)
{
  "operation": "resize",
  "input": {
    "format": "png",
    "width": 256,
    "height": 256,
    "bytes": 2183,
    "frames": 1,
    "animated": false,
    "has_alpha": true
  },
  "source_url": "https://tanod.dev/icon.png",
  "final_url": "https://tanod.dev/icon.png",
  "format": "png",
  "content_type": "image/png",
  "bytes": 1386,
  "width": 64,
  "height": 64,
  "data_base64": "iVBORw0KGgoAAAAN",
  "upscale_prevented": false,
  "notes": [],
  "source": {
    "library": "Pillow",
    "license": "MIT-CMU (HPND)",
    "url": "https://python-pillow.org"
  }
}

What each fit gives for a 4000 × 3000 photo

With width 800 and height 800:

With only width 800 the result is 800 × 600. A 400 × 300 source with width 800 comes back at 400 × 300 with upscale_prevented, unless upscale is true.

Limits and caveats

Paying by card instead? The Apify actor Image Toolkit (tanod/image-toolkit) does the same at USD 0.005 per image plus Apify's start fee per run.

No upscaling by default. An image is never made larger unless upscale is true; upscale_prevented says when that happened.

Orientation. The EXIF orientation is applied first (auto_orient, default true), so a phone photo comes out upright.

Inputs and sizes. PNG, JPEG, WebP, GIF, TIFF, BMP, ICO or AVIF (first frame only); HEIC, SVG, PDF, PSD and EPS get a 422. Over 40 megapixels in (image_too_large) or 15 MB or 50 megapixels out (output_too_large) is a 413. Refusals are not charged. EXIF, GPS, XMP and IPTC metadata are not copied, images are not logged, and a result is kept (24 hours) only with output url.

Doing this by hand? Use the free image resizer in your browser.

Download link. Add "output": "url" to the request and the file is stored for 24 hours and returned as a link (url, expires_at, sha256) instead of base64, which keeps it out of your context window. The price is the same. How the links work.

Price and free allowance

USD 0.002 per call, paid in USDC on Base, Polygon, Solana, BNB Chain or Arbitrum with x402. 3 free calls per IP per UTC day with the header X-Tanod-Free: 1. The pool is shared by every image operation. MCP tool: image_resize at https://tanod.dev/mcp, where the free tier is automatic.

All endpoints →

Use it from Claude without writing code: in claude.ai or Claude Desktop, add https://tanod.dev/mcp/images?via=image-resize-api as a custom connector (steps), then ask in plain words, for example "Resize this image to 800 pixels wide." The free daily allowance is applied automatically over MCP. Beyond it a call needs an x402 payment, which these clients can make.

Related guides: How to generate several thumbnail sizes from one image with an API, How to compress an image to a target file size with an API, How to crop an image to a box or an aspect ratio with an API. Back to tanod.dev or the guide index. Results are automated and heuristic.