Prompt
WebP conversion for site images
Latest observation
Nov 2, 2026
OpenAI APIWeb search: off
If you want to convert site images to WebP, the best approach depends on whether you mean:
- Batch-convert existing image files for a website, or
- Serve WebP automatically from your app/CDN.
Common ways to convert images to WebP
Command line with ImageMagick
magick input.jpg -quality 80 output.webp
Batch example:
for f in *.jpg; do magick "$f" -quality 80 "${f%.*}.webp"; done
Using ffmpeg (good for some workflows, especially if images are in a pipeline)
ffmpeg -i input.png output.webp
Python with Pillow
from PIL import Image
img = Image.open("input.png").convert("RGB")
img.save("output.webp", "webp", quality=80)
Best practices for website images
- Use quality 70–85 as a starting point.
- Keep JPEG/WebP for photos.
- Use PNG/WebP for transparency.
- Consider generating fallback formats for older browsers.
- Use
<picture>tags if you need graceful fallback:
<picture>
<source srcset="image.webp" type="image/webp">
<img src="image.jpg" alt="Example">
</picture>
If you want automatic serving
You can configure:
- Nginx/Apache
- Next.js / Vite / Remix / Rails / Django
- Cloudflare Images / Imgix / Akamai / Fastly
If you want, I can give you:
- a batch script for your OS,
- a Node/Python solution,
- or a server config to deliver WebP automatically.