Google's WebP format shrinks images 25–35% smaller than JPEG at the same quality, and it's the only format that supports both lossless transparency and lossy compression in a single container. Every major browser has supported WebP for years — but converting images to WebP has always meant firing up Photoshop, installing a CLI tool, or hunting through online converters that watermark your files and delete them after an hour.
Not anymore. One curl command. No signup. No API key. You can convert any publicly accessible image to WebP right now, in whatever quality you need.
Free endpoint. No auth. Works with curl, Python, JavaScript, or any HTTP client.
Try the WebP converter nowIf you run a website, process user uploads, or generate social media images, WebP is the single easiest performance win you can make:
The only reason everyone isn't already on WebP is friction: you need either a build pipeline plugin, a desktop app, or a script. We wanted to make it as easy as typing one URL.
Our image conversion endpoint takes an image URL and an output format, and returns the converted image directly. Here's the most basic WebP conversion:
curl "https://agentmediatools.com/api/media/convert?url=https://example.com/photo.jpg&format=webp" -o photo.webp
That's it. The API fetches photo.jpg from your URL, converts it to lossy WebP at default quality (85), and streams the result back. You save it locally with -o photo.webp.
Quality is a number from 1 (smallest file, worst quality) to 100 (largest file, best quality). The default is 85, which is virtually indistinguishable from the original on most photos but cuts file size dramatically.
# Maximum quality — almost lossless, still smaller than JPEG curl "https://agentmediatools.com/api/media/convert?url=https://example.com/photo.jpg&format=webp&quality=95" -o photo-max.webp # Ultra-compressed — great for thumbnails or previews curl "https://agentmediatools.com/api/media/convert?url=https://example.com/photo.jpg&format=webp&quality=30" -o photo-tiny.webp
Here's a quick rule of thumb for quality settings:
If your image is on your local machine, you need a public URL. The easiest way is to upload it to a temporary host or use a paste-and-share service. But if you have a server or a cloud bucket, you can also pipe the file:
# Upload your local file to a temporary URL (example using 0x0.st) curl -F "file=@screenshot.png" https://0x0.st # Returns something like: https://0x0.st/AbCd.png # Then convert that URL to WebP curl "https://agentmediatools.com/api/media/convert?url=https://0x0.st/AbCd.png&format=webp&quality=80" -o screenshot.webp
You can also POST your image binary directly to the conversion endpoint with multipart/form-data, and we'll convert it in one step:
curl -X POST \ -F "file=@screenshot.png" \ -F "format=webp" \ -F "quality=80" \ "https://agentmediatools.com/api/media/convert" \ -o screenshot.webp
One-off conversions are fine, but if you have a directory full of JPEGs and PNGs you want to convert to WebP, you need a script. Here's a Python snippet that walks a folder, converts every image, and preserves the folder structure:
#!/usr/bin/env python3
"""Batch-convert all images in a directory to WebP."""
import os
import sys
import requests
from pathlib import Path
API = "https://agentmediatools.com/api/media/convert"
INPUT_DIR = sys.argv[1] if len(sys.argv) > 1 else "./images"
QUALITY = int(sys.argv[2]) if len(sys.argv) > 2 else 80
for path in Path(INPUT_DIR).rglob("*"):
if path.suffix.lower() not in (".jpg", ".jpeg", ".png", ".gif", ".tiff", ".bmp"):
continue
# Build output path with .webp extension
out_path = path.with_suffix(".webp")
out_path.parent.mkdir(parents=True, exist_ok=True)
print(f"Converting {path} → {out_path}")
with open(path, "rb") as f:
resp = requests.post(API, files={"file": f},
data={"format": "webp", "quality": str(QUALITY)})
if resp.status_code == 200:
with open(out_path, "wb") as out:
out.write(resp.content)
print(f" ✓ Saved ({len(resp.content) / 1024:.1f} KB)")
else:
print(f" ✗ Error: {resp.status_code} {resp.text}")
print("Done.")
Save this as to-webp.py and run:
python3 to-webp.py ./my-photos 85
It'll walk every subdirectory, convert any image it finds to WebP at quality 85, and write the .webp file next to the original. The originals are untouched — you can review and delete them later.
If you run a Claude Desktop, ChatGPT with tools, or a self-hosted agent like Hermes, you can give your agent WebP conversion as a tool. Our MCP server exposes convert_image directly:
Get your MCP config from the dashboard and add the endpoint to your MCP client. For Claude Desktop, it's a one-line addition to your claude_desktop_config.json.
Tell your agent: "Convert this PNG to WebP at quality 80" — and it handles the rest. The agent fetches the image, calls convert_image with format=webp, and returns the result.
Chain it with other tools. Your agent can resize first, then convert to WebP, then compress, then upload — all in one pipeline. See our Pipeline Builder guide for chaining multiple API calls.
Example agent prompt you can paste right now:
You have access to the convert_image tool. Fetch the image at https://example.com/header.png, convert it to WebP at quality 75, and return the download URL.
AVIF (AV1 Image File Format) is newer and often compresses 20–30% better than WebP. So why use WebP?
<picture> tags. Both our API supports both formats.In short: if you're converting images for a real website today, WebP is the safest bet. If you're building for tomorrow, add AVIF too.
We tested on three common scenarios. Original → WebP at quality 80:
| Image | Original | WebP | Savings |
|---|---|---|---|
| Photo (4000×3000 JPEG) | 3.4 MB | 1.1 MB | 68% |
| Screenshot (1920×1080 PNG) | 1.8 MB | 520 KB | 71% |
| Logo (512×512 PNG with alpha) | 180 KB | 84 KB | 53% |
The transparency in the logo? Preserved perfectly. WebP handles alpha channels natively — no more choosing between "transparent PNG (huge)" and "solid-background JPEG (small)".
For production deployments, you want WebP conversion to happen automatically. Here's a quick GitHub Actions workflow that converts every new image in a PR to WebP:
name: Convert images to WebP
on: [pull_request]
jobs:
webp:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Convert all PNGs/JPEGs to WebP
run: |
find . -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" \) \
-exec curl -X POST -F "file=@{}" \
-F "format=webp" -F "quality=82" \
"https://agentmediatools.com/api/media/convert" \
-o "{}.webp" \;
- name: Commit WebP files
run: |
git config user.name "WebP Bot"
git add '*.webp'
git commit -m "Auto-convert images to WebP" || true
git push
Adjust the quality and file patterns to match your project. The API is free for basic use — no rate limits for reasonable usage.
Yes, we support that too. If you pass a GIF URL, converting to WebP produces an animated WebP file — the same visual result, usually at half the file size. Animated WebP works in Chrome, Firefox, and Opera. Safari added support in Safari 16.
curl "https://agentmediatools.com/api/media/convert?url=https://example.com/animation.gif&format=webp&quality=75" -o animation.webp
WebP conversion doesn't need to be complicated. No binary to install, no library to vendor, no signup form to fill. One curl command turns any image into a smaller, faster-loading WebP — and the same endpoint works from Python, JavaScript, your CI pipeline, or your AI agent.
Give it a try with your own image:
curl "https://agentmediatools.com/api/media/convert?url=https://agentmediatools.com/images/mira/mira-icon.png&format=webp&quality=75" -o mira.webp
That's a ~30 KB PNG becoming a ~15 KB WebP with no visible quality loss. If that's not a free lunch, we don't know what is.
Free. No account. Works from curl, Python, and any AI agent.
Open WebP Converter →Enjoyed this? Check out our image compression guide for more ways to shrink images, or the automated image pipeline tutorial for WebP + resize + deliver workflows.