image optimizer for web


cédric (dev) said, on 21/12/2022

wavif is an experimental PNG/JPG to AVIF converter which use libaom (3.5.0) — the main purpose of it was to test some ideas for small RGBA PNG, especially on PNG which have lot of nearly translucent/invisible data. -auto (or -auto=N) is an automatic optimizer which uses heuristics to select the trade-off — it sets 'quality', chroma subsampling and 'effort'. useful range atm are 10, 20, 30, etc.


it uses a naive but fast trick to select 4:4:4 or 4:2:0 according to the image data — if 4:2:0 is picked, another heuristic could adjust some internal lib's stuff or wavif's settings/alpha optimization. the transform would be done using libsharpyuv which often give nice results (at the cost of speed/mem)

infile outfile res time
1,79 MB 530,35 KB 4:4:4 0,35s
459,35 KB 38,08 KB 4:4:4 0,08s
24,92 KB 14,26 KB 4:4:4 0,07s
73,73 KB 20,24 KB 4:2:0 0,05s


it does not only quantize data where the alpha value would be zero, it also changes the image data itself to make it more compressible. most of the time, this would affect metrics results, filesize and speed positively but not always. the demo use exact same settings but 'alpha optimizer' turned on/off

opt infile outfile dssim butteraugli time
off 423,42 KB 72,35 KB 29361 1.77 0,09s
on 423,42 KB 54,58 KB 28989 1.75 0,09s

other stuff

based on pingo, wavif inherits some of its features

  • it converts PNG/JPG to sRGB using the color profile (including CMYK)
  • transforms — resize (partial resampling for huge JPG), selective sharpness, grayscale or remove transparency
  • filehandler — auto-multithreading/processing, folder support, drag-and-drop

demos are done using wavif 0.25 on Intel(R) Core(TM) i5-12400 (6C, 12T), 2.50 GHz — 16,0 Go DDR4 RAM — WD Black SN750 1 To — Windows 11 Pro. the libaom was compiled with SSEx/AVX