“For starters, we need to understand what WebP is. The format is
lossy, like standard JPEG, meaning that it uses compression to
remove bytes in a way that (hopefully) the eye will not notice.
JPEG files typically split the image into 8-by-8 blocks, then
perform a discrete cosine transform (DCT) on each block, and toss
out some of the least-significant-digit data in the resulting high
frequencies. That’s where most of the size savings come from; our
eyes aren’t as sensitive to that high-frequency data, so JPEGs
sweep them under the carpet.
“There are actually quite a few options defined by the JPEG
codec standard (including lossless compression), which is what
gives rise to the JPEG “quality” setting — as you crank the
quality down when you export an image, the algorithm adapts to toss
out more and more information. But the gist remains the same.”