cwebp
Google WebP image encoder
TLDR
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 (animated PNG and WebP are not supported). For lossy compression, the -q parameter controls the quality-size tradeoff. For lossless, the -z parameter controls compression effort. Using -o - sends the encoded output to stdout.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, default 100 = no preprocessing; 60 is typical). Triggers lossless mode.-alpha_q QUALITY
Alpha channel quality (0-100, default 100 = lossless alpha).-resize WIDTH HEIGHT
Resize to the given dimensions. A value of 0 for one dimension preserves the aspect ratio.-crop X Y W H
Crop the input image to the rectangle at (X,Y) with width W and height H.-preset NAME
Preset: default, photo, picture, drawing, icon, text. Must appear before other options.-m METHOD
Compression method (0-6, default 4; higher is slower but produces smaller files).-z LEVEL
Lossless compression preset (0-9, 0 fastest / 9 slowest; a good default is 6).-exact
Preserve RGB values in fully transparent areas (lossless only).-mt
Use multi-threading if available.-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.
