CLI tool and native macOS app to batch convert images to WebP format. Handles single files, multiple files, and entire directories with concurrent processing, atomic writes, and mtime-based skip logic.
npx towebp photo.pngConverts photo.png to photo.webp in the same directory.
Global (adds towebp to your PATH):
npm install -g towebpRun without installing (via npx):
npx towebp photo.pngFrom source:
git clone https://github.com/keiver/towebp.git
cd towebp
npm install && npm run build && npm link# Convert a single file (output next to source)
towebp photo.png
# Convert multiple files at once
towebp photo.png banner.jpg logo.gif
# Convert all images in a directory
towebp images/
# Convert to a separate output directory
towebp -o output/ images/
# Custom quality (1-100, default: 90)
towebp -q 80 photo.png
# Recursive subdirectory processing
towebp -r images/
# Combine flags
towebp -q 75 -r -o dist/ src/assets/| Flag | Description |
|---|---|
-q, --quality <n> |
WebP quality 1-100 (default: 90) |
-o, --output <dir> |
Output directory (default: next to source) |
-r, --recursive |
Process subdirectories recursively |
-h, --help |
Show help message |
-v, --version |
Show version number |
- Accepts multiple input files and directories in a single command
- Skips files that haven't changed (compares mtime)
- Gracefully skips non-image files with a warning
- Atomic writes via temp file + rename
- Concurrent processing (up to 4 workers)
- Color space conversion (display-p3 / RGB to sRGB)
- Auto-rotation based on EXIF data
- Recursive subdirectory support with mirrored output structure
JPG, JPEG, PNG, GIF, BMP, TIFF, WebP
Native SwiftUI app that wraps the CLI. Drag and drop images or folders to convert them — output is generated next to each source file.
- macOS 14+
- Swift 6.2+
- The
towebpCLI must be installed and available in your PATH
cd app
swift runcd app
./install-app.shThis builds a release binary, creates an app bundle at /Applications/Lazy Webp.app (dev.keiver.lazywebp), and signs it locally.
- Drag-and-drop files and folders
- File picker dialog
- Quality slider (1-100)
- Per-file size and savings display
- Live progress tracking with cancel support
- Always-on-top floating window
- Menu bar icon with quick access
- Launch at login option
- Install to /Applications from the menu bar
| Component | Requires |
|---|---|
| CLI | Node.js 18+, Sharp |
| macOS App | macOS 14+, Swift 6.2+ |
| Script | Description |
|---|---|
npm run dev |
Run directly from TypeScript source |
npm run build |
Compile to JavaScript in dist/ |
npm start |
Run compiled build |
npm test |
Run tests |
npm run test:watch |
Run tests in watch mode |
MIT

