cwebp
TLDR
Convert an image to WebP format
SYNOPSIS
cwebp [options] inputfile **-o** outputfile.webp
DESCRIPTION
cwebp is Google's encoder for the WebP image format. WebP provides superior compression compared to JPEG and PNG while supporting both lossy and lossless modes, as well as animation and alpha transparency.
The encoder accepts PNG, JPEG, TIFF, and WebP inputs. For lossy compression, the -q parameter controls the quality-size tradeoff. For lossless, the -z parameter controls compression effort.
WebP is widely supported in web browsers and offers 25-34% smaller file sizes than JPEG at equivalent quality. The lossless mode typically achieves 26% smaller files than PNG.
PARAMETERS
-o FILE
Output WebP file path.-q QUALITY
Compression quality (0-100, default 75). Higher is better quality.-lossless
Encode image losslessly.-near_lossless LEVEL
Near-lossless preprocessing (0-100, 0 is maximum preprocessing).-alpha_q QUALITY
Alpha channel quality (0-100).-resize WIDTH HEIGHT
Resize to specified dimensions.-crop X Y W H
Crop the input image.-preset NAME
Preset: default, photo, picture, drawing, icon, text.-m METHOD
Compression method (0-6, higher is slower/better).-z LEVEL
Lossless compression preset (0-9).-v
Verbose output.
CAVEATS
Very high quality settings may produce files larger than the source. Some older software doesn't support WebP. Lossy WebP introduces artifacts similar to JPEG. Near-lossless mode modifies pixels slightly for better compression.
HISTORY
WebP was developed by Google and released in 2010, based on the VP8 video codec. The cwebp encoder is part of the libwebp reference implementation. WebP achieved widespread browser support by 2020 and is recommended for web image optimization.


