png2webp-cli
v1.1.0
Published
Fast PNG/JPG/JPEG to WebP converter CLI
Maintainers
Readme
png2webp-cli
Fast PNG/JPG/JPEG to WebP converter for the command line. Built with sharp for maximum performance.
Installation
npm install -g png2webp-cliOr use directly with npx:
npx png2webp-cli image.pngUsage
png2webp <input> [options]Arguments
| Argument | Description |
|----------|-------------|
| input | PNG/JPG/JPEG file or directory to convert |
Options
| Option | Description | Default |
|--------|-------------|---------|
| -q, --quality <number> | WebP quality (1-100) | 80 |
| -o, --output <path> | Output file or directory | same as input |
| -r, --recursive | Process directories recursively | false |
| -d, --delete | Delete original file after conversion | false |
| -v, --verbose | Show per-file details | false |
| -V, --version | Show version | |
| -h, --help | Show help | |
Examples
# Convert a single PNG
png2webp image.png
# Convert a single JPG
png2webp photo.jpg
# Convert with custom quality
png2webp image.png --quality 90
# Convert all images in a directory
png2webp ./assets/
# Recursive conversion
png2webp ./assets/ --recursive
# Output to specific directory
png2webp ./assets/ --output ./optimized/
# Delete originals after conversion
png2webp ./assets/ --recursive --deleteSupported formats
- PNG
- JPG / JPEG
Requirements
- Node.js >= 18.0.0
License
MIT © Raul Camacho
