Comment #5 on issue 340 by
pascal.m...@gmail.com: Colors get distorted when cwebp converts png to webp
https://bugs.chromium.org/p/webp/issues/detail?id=340#c5default encoding parameter for 'cwebp' is to use lossy encoding.
This means that small (hopefully unnoticeable) differences between source and compressed images are unavoidable. The differences are smaller and smaller in amplitude as one raises the -q parameter value.
Still, even at q=100, one can get a +/-1 difference (mostly because of the colorspace transfer: RGB <-> YUV, which incurs some rounding error).
You would obverse similar difference if compressing to JPEG format.
If the difference is too large, one solution is to raise the -q parameter, to 85 for instance.
Alternatively, if you want to guarantee a minimum level of distortion, you can use the option '-psnr 40' or more (like: '-psnr 42').
Regarding issue #308: yes, this is a similar problem. Note however that in bug #308 the problem is exacerbated because the initial gray value is around #80, an area where the human visual system is most sensitive.
For values saturated above #f0, the effect of lossy compression is somewhat harder to spot.