cwebp
$ cwebp Official Low RiskGoogle's official libwebp CLI suite centers on cwebp for encoding PNG/JPEG/TIFF images to lossy or lossless WebP, paired with dwebp for decoding, webpmux for animations/ICC/EXIF muxing, and webpinfo for inspecting WebP RIFF chunks.
brew install webp Encoding web assets to WebP and checking RIFF headers via webpinfo is strictly local and needs no MCP.
Agent-Readiness Checklist
Local Probe EvidenceCaptured --help excerpt
Usage:
cwebp [-preset <...>] [options] in_file [-o out_file]
If input size (-s) for an image is not specified, it is
assumed to be a PNG, JPEG, TIFF or WebP file.
Note: Animated PNG and WebP files are not supported.
Options:
-h / -help ............. short help
-H / -longhelp ......... long help
-q <float> ............. quality factor (0:small..100:big), default=75
-alpha_q <int> ......... transparency-compression quality (0..100),
default=100
-preset <string> ....... preset setting, one of:
default, photo, picture,
drawing, icon, text
-preset must come first, as it overwrites other parameters
-z <int> ............... activates lossless preset with given
level in [0:fast, ..., 9:slowest]
-m <int> ............... compression method (0=fast, 6=slowest), default=4
-segments <int> ........ number of segments to use (1..4), default=4
-size <int> ............ target size (in bytes)
-psnr <float> .......... target PSNR (in dB. typically: 42)
-s <int> <int> ......... input size (width x height) for YUV
-sns <int> ............. spatial noise shaping (0:off, 100:max), default=50
-f <int> ............... filter strength (0=off..100), default=60
-sharpness <int> ....... filter sharpness (0:most .. 7:least sharp), default=0
-strong ................ use strong filter instead of simple (default)
-nostrong .............. use simple filter instead of strong
-sharp_yuv ............. use sharper (and slower) RGB->YUV conversion
-partition_limit <int> . limit quality to fit the 512k limit on
the first partition (0=no degradation ... 100=full)
-pass <int> ............ analysis pass number (1..10)
-qrange <min> <max> .... specifies the permissible quality range
(default: 0 100)
-crop <x> <y> <w> <h> .. crop picture with the given rectangle
-resize <w> <h> ........ resize picture (*after* any cropping)
-resize_mode <string> .. one of: up_only, down_only, always (default)
-mt .................... use multi-threading if available
-low_memory ............ reduce memory usage (slower encoding)
-map <int> ............. print map of extra info
-print_psnr ............ prints averaged PSNR distortion
-print_ssim ............ prints averaged SSIM distortion
-print_lsim ............ prints local-similarity distortion
-d <file.pgm> .......... dump the compress FCRS-1.0 6-Dimension Breakdown
Deterministic non-interactive CLI with -quiet, -o - stdout support, and -longhelp, though no JSON output or --dry-run.
- Supports
-quiet,-o -, and-longhelp - No JSON output or
--dry-run
Requires separate -o output path so source files are never mutated in-place, and webpinfo provides read-only inspection.
- Non-destructive to source images;
webpinfois read-only
Prebuilt Google binaries and packages across Homebrew (webp), Linux, and Windows.
- Available via
brew install webpand official Google downloads
Reference WebP encoder supporting lossy, -lossless, -resize, -crop, and -metadata control.
- Official
libwebpencoder with full codec tuning
Official Google libwebp reference tools under permissive BSD-3-Clause license.
- Maintained by Google WebP team
Clear Google Developers manual and -h/-longhelp flag documentation.
- Documented at developers.google.com/speed/webp/docs/cwebp
Security, Auth & Guardrails
None required; operates on local image files or stdio (-o -).
Free BSD-3-Clause open-source binary suite from Google.
# cwebp (WebP) Agent Rules - Always pass `-o <output.webp>` and `-quiet` on `cwebp` so stderr stats do not pollute logs. - Remember `cwebp` writes to a separate `-o` file and never modifies input PNG/JPEG files; use `-lossless` for UI screenshots and diagrams.
Agent-Ready Command Recipes
Safe Read-Only Queries
webpinfo -summary image.webp
Reads WebP RIFF structure, alpha/animation flags, and dimensions without modifying the file.
Controlled Writes & Previews
cwebp -quiet -q 80 input.png -o output.webp
Converts input.png to output.webp at quality 80 while suppressing progress chatter.
Strengths for Agents
- + Official Google reference encoder with
-lossless,-near_lossless, and-quietmodes. - + Bundled
webpinfo -summaryanddwebpcover inspection and decoding cleanly.
Caveats & Pitfalls
- ! Does not accept animated GIF directly (
gif2webpis required for GIF-to-WebP). - ! Uses single-dash flags (
-quiet,-lossless) and lacks--no-overwriteor JSON output.