set a specific quality factor for JPG

last modified on 9 July 2019, by Cédric Louvrier

pingo could set a specific quality factor to target another size/quality ratio. this lossy transformation change the quality factor for the quantization

N: from 1 to 100 — 1: smaller filesize, worse quality — 100: bigger filesize, better quality
pingo -jpgquality=N target
original file: bees.png (170.34 KB): set JPG quality
original pingo -jpgquality=100 pingo -jpgquality=90
bees - original bees - jpgquality100 bees - jpgquality90
170.34 KB 136.72 KB (0.39s) 34.80 KB (0.09s)
dssim - butteraugli 0.00008498 — 0.658188 0.00057235 — 1.874186
pingo -jpgquality=80 pingo -jpgquality=70 pingo -jpgquality=60
bees - jpgquality80 bees - jpgquality70 bees - jpgquality60
23.29 KB (0.09s) 18.18 KB (0.10s) 15.05 KB (0.11s)
0.00118645 — 2.448357 0.00186335 — 3.038034 0.00269529 — 3.283224
pingo -jpgquality=50 pingo -jpgquality=40 pingo -jpgquality=30
bees - jpgquality50 bees - jpgquality40 bees - jpgquality30
12.92 KB (0.18s) 10.98 KB (0.09s) 9.03 KB (0.12s)
0.00352294 — 3.546728 0.00475731 — 4.098587 0.00689488 — 4.679189
pingo -jpgquality=20 pingo -auto
bees - jpgquality20 bees - jpgquality1
7.88 KB (0.18s) 29.90 KB (0.12s)
0.00885966 — 5.510418 0.00074798 — 2.320620

quality controls

pingo could try to estimate how much is the quality factor if you target lossy JPG compression. this factor could be less than pingo's default. in this case, pingo could avoid to process the image data because results have high chance to be bigger (it could however process the file to remove some segments like comments)

original file: station-sample2-q60.jpg automatically skip image processing
original -auto
station - sample 2 q60 station - sample 2 (not processed)
52.72 KB (quality 60) skipped (image data not processed)

compression level

note that the lossless compression level over this transformation can be increased to get smaller filesize by using -sN

N: from 0 to 9 — 0: fast and good compression — 9: slow, but better compression
pingo -jpgquality -sN target