๐ผ๏ธ AI Agent Skill โ batch convert JPG/PNG images to WebP format instantly, with a single conversation command.
Works with Hermes Agent, or any automation script running on macOS/Linux.
image2webp-skill is an AI Agent Skill that converts images to WebP format. Tell your agent "convert these images to WebP" and it handles the rest โ single file or entire directory, recursive, with compression stats.
It wraps Google's cwebp encoder into a simple, agent-friendly interface. No GUI, no drag-and-drop, no manual clicking through Pixelmator. Just point it at a path and walk away.
Converting images to WebP manually is tedious:
- Open Pixelmator (or another editor)
- File โ Export โ WebP
- Adjust quality slider
- Save
- Repeat for every. single. image.
When you have 20 screenshots, this is soul-crushing. image2webp-skill makes it a one-line conversation:
"Convert
~/Downloads/to WebP"
Done. All JPG/PNG files recursively converted. You get a summary with before/after sizes.
You (via AI Agent)
โ "Convert this folder to WebP"
โผ
Skill: image2webp-skill
โ scripts/convert.sh <path> [quality]
โผ
cwebp (Google WebP encoder, via Homebrew)
โ Reads JPEG/PNG/TIFF
โ Encodes to WebP
โผ
.webp files written to same directory
No network. No external services. Just a bash script โ cwebp โ done.
brew install webpThat's it. cwebp is part of Google's webp package.
# Clone into your Hermes skills directory
cd ~/.hermes/skills/custom/
git clone https://github.com/colin-chang/image2webp-skill.git image2webp-skillUser: Convert ~/Desktop/screenshot.png to WebP
User: Convert ~/Downloads/blog-images/ to WebP, quality 90
User: Batch convert all images in ~/Pictures/ to WebP
The agent loads the skill, runs scripts/convert.sh, and reports back:
๐ ๆซๆ: /Users/colin/Downloads
โ photo1.jpg โ photo1.webp (1.2MB โ 145KB, -88%)
โ photo2.png โ photo2.webp (3.4MB โ 480KB, -86%)
โ photo3.jpg โ photo3.webp (856KB โ 98KB, -89%)
๐ ๅฎๆ: 3/3 ๆๅ
# Single file
./scripts/convert.sh ~/Desktop/photo.png
# Entire directory (recursive)
./scripts/convert.sh ~/Downloads/ 80
# With custom quality
./scripts/convert.sh ~/Pictures/ 90| Feature | Description |
|---|---|
| ๐ฏ Single file | Convert one image: convert.sh photo.jpg |
| ๐ Directory batch | Recursively convert all images in a folder |
| ๐งต Multi-threaded | -mt flag enables parallel encoding |
| ๐ Compression stats | Shows before/after size and reduction % |
| ๐ Non-destructive | Original files are never deleted |
| ๐ Offline | Zero network calls โ everything runs locally |
| ๐๏ธ Configurable quality | -q 0-100 (default: 80) |
| Input | Output | Notes |
|---|---|---|
JPEG (.jpg, .jpeg) |
.webp |
โ Full support |
PNG (.png) |
.webp |
โ Full support, alpha preserved |
TIFF (.tiff, .tif) |
.webp |
โ Supported by cwebp |
| GIF, SVG, BMP, HEIC | โ | โ Not supported by cwebp encoder |
| Parameter | Value | Description |
|---|---|---|
Quality (-q) |
80 |
0-100, higher = better quality, larger file |
Compression method (-m) |
6 |
0 (fast) to 6 (slowest, smallest file) |
Multi-threading (-mt) |
On | Use all CPU cores |
Output mode (-quiet) |
On | Only show summary, not per-file encoder output |
| Document | Description |
|---|---|
| SKILL.md | Full skill reference (triggers, workflow, output format) |
| SECURITY.md | Security considerations and attack surface |
| PRIVACY.md | Data handling and privacy guarantees |
- macOS โ tested on macOS 15 (Sequoia)
- Linux โ should work (requires
cwebpfrom package manager) cwebpinstalled via:- macOS:
brew install webp - Ubuntu/Debian:
apt install webp - Fedora:
dnf install libwebp-tools
- macOS:
This Skill is agent-agnostic โ it's a shell script. Any agent platform that can execute shell commands can use it:
| Agent / Platform | Integration |
|---|---|
| Hermes Agent | Native Skill โ place in ~/.hermes/skills/custom/ |
| Claude Code | Add to CLAUDE.md, invoke via terminal |
| OpenCode / Codex | Add to project instructions, invoke via shell |
| Any shell script | ./scripts/convert.sh /path/to/images |
MIT โ see LICENSE
Q: Does this delete my original images?
A: No. Original files are never modified or deleted. .webp files are created alongside the originals.
Q: Can I adjust the compression quality?
A: Yes. Pass a second argument: ./scripts/convert.sh ~/Photos/ 90 (0-100, default 80).
Q: Does it handle subdirectories? A: Yes. Directory mode recursively scans all subdirectories.
Q: What if a .webp file already exists?
A: It will be overwritten. The script doesn't skip existing files.
Q: Can I convert GIFs or SVGs?
A: No. cwebp only supports JPEG, PNG, TIFF, and WebP as input formats.