compare WebP near-lossless and nigh-lossless

last modified on 29 February 2020, by Cédric Louvrier

the WebP nigh-lossless is an alternative of the near-lossless implementation from the libwebp

near-lossless

  • -near_lossless 100 from the cwebp could do lossless (as -lossless). inputs could be less than 100 (e.g. 80, 60, 40, 20 or less)
  • near-lossless do not seem to benefit from multithreading (cwebp -mt)
  • low numbers could transform image data too far from the original

nigh-lossless

this is an automatic near-lossless mode with adaptive tranformations. below 60, it could use the lossy from libwebp. with right settings, it could offer better quality, smaller size, and/or more speed than near-lossless on RGBA with complex structure

comparison

original file: chair.png (175.86 KB): alternative near-lossless WebP (lossy)
cwebp -near_lossless 99 -m 6 pingo -webp-nigh=99 -s9
chair - cwebp near lossless 99 chair - webp color 99
112.44 KB (0.55) 108.36 KB (0.35s)
0.00003258 - 1.086502 0.00003130 - 0.445320
cwebp -near_lossless 1 -m 6 pingo -webp-nigh=60 -s9 pingo -webp-nigh=1 -s9
chair - cwebp near lossless 99 chair - webp color 60 chair - webp color 60
93.71 KB (0.54s) 82.57 KB (0.29s) 54.89 KB (0.26s)
0.00032285 - 5.680343 0.00013308 - 1.097308 0.00023271 - 1.774412
original file: strawberry.png (276.89 KB): alternative near-lossless WebP (lossy)
cwebp -near_lossless 99 -m 6 pingo -webp-nigh=80 -s9
strawberry - cwebp near lossless 99 strawberry - near lossless 80
156.74 KB (0.61s) 138.32 KB (0.39s)
0.00004820 - 1.159583 0.00006483 - 0.684425
cwebp -near_lossless 1 -m 6 pingo -webp-nigh=60 -s9 pingo -webp-nigh=1 -s9
strawberry - near lossless 60 strawberry - near lossless 60 strawberry - near lossless 1
133.92 KB (0.61s) 128.11 KB (0.39s) 77.56 KB (0.25s)
0.00038273 - 5.064255 0.00011695 - 0.984978 0.00028544 - 2.325289
original file: firefox.png (22.01 KB KB): alternative near-lossless WebP (lossy)
cwebp -near_lossless 1 -m 6 pingo -webp-nigh=1 -s9
firefox - cwebp near lossless 1 firefox - near lossless 1
9.98 KB (0.08s) 10.81 KB (0.09s)
0.00034583 - 3.566192 0.00000057 - 0.603598

experimental

do backup before using pingo. this demonstration is an experimental process — barely tested on some files only. it could be less efficient than other well known implementation or tools introduced (or not) in this article