@cammarj/png2webp
v1.0.0
Published
Fast PNG to WebP converter CLI
Maintainers
Readme
@cammarj/png2webp
Fast PNG to WebP converter for the command line. Built with sharp for maximum performance.
Installation
npm install -g @cammarj/png2webpOr use directly with npx:
npx @cammarj/png2webp image.pngUsage
png2webp <input> [options]Arguments
| Argument | Description |
|----------|-------------|
| input | PNG 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 PNG after conversion | false |
| -v, --verbose | Show per-file details | false |
| -V, --version | Show version | |
| -h, --help | Show help | |
Examples
# Convert a single file
png2webp image.png
# Convert with custom quality
png2webp image.png --quality 90
# Convert all PNGs 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 --deleteRequirements
- Node.js >= 18.0.0
License
MIT © Raul Camacho
