← Blog

WebP encoder method — what the speed/size dial actually does

Optimisation level → encoder method & pass count → output size and encode time trade-off Mapping inside our pipeline opt level method pass relative time relative size 0 1 1 1.0× 1.00× (baseline) 1 2 1 1.4× 0.97× 2 3 1 2.0× 0.94× (default) 3 4 2 3.5× 0.91× What method tunes predictor block search depth, transform block size search, filter strength selection, segmentation analysis, entropy mode

The WebP encoder takes a quality slider (0–100) like JPEG, but it has a second knob that JPEG doesn't have: a method selector from 0 to 6. Method is independent of quality. It controls how hard the encoder works to find the smallest representation of a given quality target — slower methods explore more options and pick smaller ones.

Our pipeline exposes this as an "optimisation level" 0–3 that maps to method 1–4 plus a pass count. This article walks through what's actually different between those settings and when each one is the right choice.

What method tunes inside the encoder

WebP's lossy encoder makes a series of choices for each block of the image:

Method 0 makes the simplest choice for each. Method 6 exhaustively searches. The size difference between methods 0 and 6 is typically 5–8% on photographic content, and the time difference is roughly 7–10×.

Our mapping from optimisation level to method

The pipeline exposes four optimisation levels:

level 0  →  method = 1, pass = 1   (fastest)
level 1  →  method = 2, pass = 1
level 2  →  method = 3, pass = 1   (default)
level 3  →  method = 4, pass = 2   (slowest, smallest)

We don't go above method 4 or below method 1. Method 0 is rarely useful (the speed gain over 1 is small; the size cost is real), and methods 5–6 trade encoding time at a worse rate than is worth on a browser-side pipeline.

The pass count

WebP supports running the analysis pass twice for slightly better results. The first pass collects statistics about the image; the second pass uses them to make better decisions. We enable two-pass only at the highest optimisation level — it doubles encode time and saves about 1%.

For typical photo workflow, pass = 1 is enough. The encoder's per-block decisions are good even on a single look at the image. Pass = 2 is for archive workflows where the file will be served millions of times and 1% matters.

Quality and method are independent

You can set quality 80 with method 1, or quality 80 with method 4. Both produce visually equivalent images at quality 80. The difference is purely how big the file is and how long encoding took.

This is different from JPEG, where quality is the only knob. WebP gives you two: quality controls the perceptual fidelity target, method controls how efficiently the encoder reaches that target.

What to pick for what use case

Other knobs we hold fixed

The WebP encoder exposes about thirty parameters. Most of them shouldn't be touched in a general-purpose tool. The ones we set to fixed reasonable values:

The rest of the parameters live in the file specification and rarely warrant attention from anyone but encoder researchers.