2025-03-14 21:59:59 -06:00
|
|
|
# cwebp
|
|
|
|
|
|
|
|
|
|
> Compress an image file to a WebP file.
|
|
|
|
|
> More information: <https://developers.google.com/speed/webp/docs/cwebp>.
|
|
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
- Compress a WebP file with default settings (lossy compression, q = 75) to the [o]utput file:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
`cwebp {{path/to/image_file}} -o {{path/to/output.webp}}`
|
|
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
- Compress a WebP file with the best lossy compression [q]uality and largest file size:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
`cwebp {{path/to/image_file}} -o {{path/to/output.webp}} -q {{100}}`
|
|
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
- Compress a WebP file with the worst lossy compression [q]uality and smallest file size:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
`cwebp {{path/to/image_file}} -o {{path/to/output.webp}} -q {{0}}`
|
|
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
- Compress a WebP file with lossless compression and smallest possible file size:
|
|
|
|
|
|
|
|
|
|
`cwebp {{path/to/image_file}} -o {{path/to/output.webp}} -z 9`
|
|
|
|
|
|
|
|
|
|
- Compress a WebP file and apply resize to image (if width or height are 0, scaling preserves aspect ratio):
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
`cwebp {{path/to/image_file}} -o {{path/to/output.webp}} -resize {{width}} {{height}}`
|
|
|
|
|
|
|
|
|
|
- Compress a WebP file and drop alpha channel information:
|
|
|
|
|
|
|
|
|
|
`cwebp {{path/to/image_file}} -o {{path/to/output.webp}} -noalpha`
|