Why Use an Image Processing API?
Every app that handles user uploads, generates thumbnails, or serves optimized images needs server-side image processing. Running your own Sharp/ImageMagick setup means managing dependencies, memory limits, and security patches. An image processing API gives you all the power via a simple REST call — resize in one request, convert to WebP in another, generate QR codes on the fly.
The Agent Image Processor is a free, open REST API built on Sharp (the fastest Node.js image library). It handles 13 operations across 6 image formats, accepts images as URLs, base64, or data URIs, and returns processed results as base64 with full metadata.
Supported Formats
All 13 Endpoints
Quick Start — Resize an Image
Resize any image by passing a URL, base64 string, or data URI. Set width, height, and fit mode (cover, contain, fill, inside, outside).
curl -X POST https://agent-gateway-kappa.vercel.app/v1/agent-imageproc/api/resize \
-H "Content-Type: application/json" \
-d '{
"image": "https://picsum.photos/800/600",
"width": 400,
"height": 300,
"fit": "cover",
"format": "webp",
"quality": 85
}'
import requests, base64
resp = requests.post(
"https://agent-gateway-kappa.vercel.app/v1/agent-imageproc/api/resize",
json={
"image": "https://picsum.photos/800/600",
"width": 400,
"height": 300,
"fit": "cover",
"format": "webp"
}
)
data = resp.json()
print(f"Size: {data['width']}x{data['height']}, {data['size']} bytes")
# Save to file
with open("thumbnail.webp", "wb") as f:
f.write(base64.b64decode(data["image"]))
const resp = await fetch(
"https://agent-gateway-kappa.vercel.app/v1/agent-imageproc/api/resize",
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
image: "https://picsum.photos/800/600",
width: 400,
height: 300,
fit: "cover",
format: "webp"
})
}
);
const data = await resp.json();
console.log(`Size: ${data.width}x${data.height}, ${data.size} bytes`);
// Save to file
import { writeFileSync } from "fs";
writeFileSync("thumbnail.webp", Buffer.from(data.image, "base64"));
Response
{
"image": "UklGRv4EAABXRUJQVl...",
"format": "webp",
"width": 400,
"height": 300,
"size": 12847,
"credits_remaining": null
}
Convert Between Formats
Convert any image to JPEG, PNG, WebP, AVIF, GIF, or TIFF in a single call. Set quality for lossy formats.
curl -X POST https://agent-gateway-kappa.vercel.app/v1/agent-imageproc/api/convert \
-H "Content-Type: application/json" \
-d '{
"image": "https://example.com/photo.png",
"format": "webp",
"quality": 80
}'
Optimize & Compress Images
Reduce file size while maintaining visual quality. The API returns the original size, optimized size, and percentage savings so you know exactly how much bandwidth you saved.
curl -X POST https://agent-gateway-kappa.vercel.app/v1/agent-imageproc/api/optimize \
-H "Content-Type: application/json" \
-d '{
"image": "https://picsum.photos/1200/800",
"format": "webp",
"quality": 75
}'
import requests
resp = requests.post(
"https://agent-gateway-kappa.vercel.app/v1/agent-imageproc/api/optimize",
json={
"image": "https://picsum.photos/1200/800",
"format": "webp",
"quality": 75
}
)
data = resp.json()
print(f"Original: {data['originalSize']} bytes")
print(f"Optimized: {data['optimizedSize']} bytes")
print(f"Savings: {data['savings']}")
const resp = await fetch(
"https://agent-gateway-kappa.vercel.app/v1/agent-imageproc/api/optimize",
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
image: "https://picsum.photos/1200/800",
format: "webp",
quality: 75
})
}
);
const { originalSize, optimizedSize, savings } = await resp.json();
console.log(`Saved ${savings} (${originalSize} → ${optimizedSize} bytes)`);
Optimization Response
{
"image": "UklGRv4EAABXRUJQVl...",
"format": "webp",
"width": 1200,
"height": 800,
"originalSize": 142506,
"optimizedSize": 38247,
"savings": "73.2%",
"credits_remaining": null
}
Generate QR Codes
Generate QR codes from any text or URL. Customize size, colors, margin, and output format.
curl -X POST https://agent-gateway-kappa.vercel.app/v1/agent-imageproc/api/qrcode \
-H "Content-Type: application/json" \
-d '{
"text": "https://api-catalog-three.vercel.app",
"size": 300,
"format": "png",
"dark": "#8b5cf6",
"light": "#0a0a0f",
"margin": 2
}'
Dynamic Placeholder Images
Generate placeholder images on the fly with custom dimensions, colors, and text. Perfect for mockups and development.
# Basic 400x300 placeholder
https://agent-gateway-kappa.vercel.app/v1/agent-imageproc/api/placeholder/400/300
# Custom colors and text
https://agent-gateway-kappa.vercel.app/v1/agent-imageproc/api/placeholder/800/400?color=1a1a2e&textColor=8b5cf6&text=Hero+Banner&format=webp
# Use directly in HTML
<img src="https://agent-gateway-kappa.vercel.app/v1/agent-imageproc/api/placeholder/200/200?text=Avatar" alt="placeholder">
Multi-Step Transform Pipeline
Chain multiple operations in a single request. Instead of making separate API calls for resize + crop + grayscale, send them all at once via the /api/transform endpoint.
curl -X POST https://agent-gateway-kappa.vercel.app/v1/agent-imageproc/api/transform \
-H "Content-Type: application/json" \
-d '{
"image": "https://picsum.photos/1200/800",
"steps": [
{"op": "resize", "width": 600, "height": 400, "fit": "cover"},
{"op": "sharpen", "sigma": 1.5},
{"op": "grayscale"}
],
"outputFormat": "webp",
"outputQuality": 85
}'
import requests
resp = requests.post(
"https://agent-gateway-kappa.vercel.app/v1/agent-imageproc/api/transform",
json={
"image": "https://picsum.photos/1200/800",
"steps": [
{"op": "resize", "width": 600, "height": 400, "fit": "cover"},
{"op": "sharpen", "sigma": 1.5},
{"op": "grayscale"}
],
"outputFormat": "webp",
"outputQuality": 85
}
)
data = resp.json()
print(f"Applied {data['stepsApplied']} operations")
print(f"Result: {data['width']}x{data['height']}, {data['size']} bytes")
const resp = await fetch(
"https://agent-gateway-kappa.vercel.app/v1/agent-imageproc/api/transform",
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
image: "https://picsum.photos/1200/800",
steps: [
{ op: "resize", width: 600, height: 400, fit: "cover" },
{ op: "sharpen", sigma: 1.5 },
{ op: "grayscale" }
],
outputFormat: "webp",
outputQuality: 85
})
}
);
const data = await resp.json();
console.log(`Applied ${data.stepsApplied} operations`);
console.log(`Result: ${data.width}x${data.height}, ${data.size} bytes`);
Available Transform Operations
| Operation | Parameters | Description |
|---|---|---|
resize | width, height, fit | Resize with fit mode |
crop | left, top, width, height | Extract region |
rotate | angle, background | Rotate by degrees |
blur | sigma | Gaussian blur |
sharpen | sigma | Sharpen details |
flip | - | Flip vertically |
flop | - | Flip horizontally |
grayscale | - | Convert to grayscale |
negate | - | Invert colors |
tint | color (r, g, b) | Apply color tint |
Composite & Watermark
Overlay one image on another — perfect for adding watermarks, logos, or badges. Control position with x/y coordinates or gravity, and adjust overlay opacity.
curl -X POST https://agent-gateway-kappa.vercel.app/v1/agent-imageproc/api/composite \
-H "Content-Type: application/json" \
-d '{
"base": "https://picsum.photos/800/600",
"overlay": "https://example.com/logo.png",
"gravity": "southeast",
"opacity": 0.7,
"format": "webp"
}'
Extract Image Metadata
Get dimensions, format, color space, DPI, alpha channel info, and EXIF orientation without downloading the full image.
curl -X POST https://agent-gateway-kappa.vercel.app/v1/agent-imageproc/api/metadata \
-H "Content-Type: application/json" \
-d '{"image": "https://picsum.photos/800/600"}'
# Response:
{
"width": 800,
"height": 600,
"format": "jpeg",
"channels": 3,
"space": "srgb",
"depth": "uchar",
"density": 72,
"hasAlpha": false,
"orientation": 1,
"size": 48291
}
Use Cases
📷 Thumbnail Generation
Automatically resize user-uploaded images to multiple sizes (avatar, card, hero) with a single transform pipeline call. Output as WebP for 30-70% smaller files than JPEG.
⚡ Image CDN / Optimization
Convert legacy JPEG/PNG assets to modern WebP or AVIF on the fly. The optimize endpoint reports exact savings percentage so you can track bandwidth reduction.
🤖 AI Agent Image Processing
Give your AI agent the ability to process screenshots, generate QR codes for sharing, add watermarks to generated content, or extract metadata from uploaded images — all via simple REST calls.
🛠 Development & Prototyping
Use the placeholder endpoint for mockups during development. Generate any size/color placeholder image instantly with custom text — no external service needed.
Comparison Table
| Feature | Agent ImageProc | Cloudinary | Imgix | Sharp (self-hosted) |
|---|---|---|---|---|
| Free tier | 15 req (no signup) | 25 credits/mo | $0 (1,000 origins) | Unlimited (self-run) |
| Resize | ✓ | ✓ | ✓ | ✓ |
| Format conversion | 6 formats | 30+ | 6 | 6 |
| WebP/AVIF | ✓ | ✓ | ✓ | ✓ |
| QR code generation | ✓ | ✗ | ✗ | Needs library |
| Placeholder images | ✓ | ✗ | ✗ | Needs code |
| Multi-step pipeline | ✓ | URL transforms | URL params | ✓ |
| Image compositing | ✓ | ✓ | ✓ | ✓ |
| Metadata extraction | ✓ | ✓ | ✓ | ✓ |
| Setup required | None | Account | Account + source | Server + Sharp |
| Input method | URL / base64 | Upload / URL | Origin URL | File / buffer |
| Paid plans | $0.002/req | From $89/mo | From $100/mo | Server costs |
Three Input Methods
Every image endpoint accepts images in three formats:
- URL — Pass any public image URL:
"image": "https://example.com/photo.jpg" - Base64 — Raw base64-encoded image data:
"image": "iVBORw0KGgo..." - Data URI — Base64 with MIME type:
"image": "data:image/png;base64,iVBORw0KGgo..."
Max upload size is 10 MB. For URL inputs, the API fetches the image server-side, so there are no CORS issues.
Frequently Asked Questions
What image formats are supported?
/api/convert endpoint or by setting the format parameter on any endpoint.Is there a rate limit?
What's the maximum image size?
Can I chain multiple operations?
/api/transform endpoint with a steps array to chain resize, crop, rotate, blur, sharpen, grayscale, flip, flop, negate, and tint operations in a single request. Each step is applied in order.How do fit modes work for resize?
cover crops to fill the target dimensions, contain fits within dimensions (may add padding), fill stretches to exact dimensions, inside preserves aspect ratio within bounds, outside covers at least the target dimensions.Can I use this for thumbnails in production?
Start Processing Images Now
13 endpoints, 6 formats, no signup. Resize, convert, optimize — one API call.
Try Placeholder Image →