image optimizer for web

pingo flags and behavior changes

if you use 0.x and ax versions, beware of those flags which have new behaviors — v1 has lot of significant changes. the goal was to simplify, automate and optimize most of stuff using SIMD implementation, multi-threading of heuristics and faster/new transformers

PNG — lossless

pingo -lossless in.png

see PNG benchmark: web lossless optimization

PNG — lossless
infile id s outfile time
47.84 MB a70 43.19 MB 17.77s
1.00 43.19 MB 2.13s
140.68 MB a70 131.86 MB 48.93s
1.00 131.86 MB 7.26s
658.02 KB a70 9 631.66 KB 0.85s
1.00 586.42 KB 0.44s

PNG — lossy

pingo in.png
PNG — lossy
infile id s outfile time
70.11 KB a70 29.02 KB 0.12s
1.00 28.10 KB 0.04s
431.34 KB a70 75.73 KB 0.19s
1.00 87.14 KB 0.08s
a70 9 69.89 KB 0.29s
1.00 4 69.79 KB 0.29s

JPEG — lossless

pingo -lossless in.jpg
JPEG — lossless
infile id s outfile time
11.87 MB a70 0 11.13 MB 0.55s
1.00 1 11.13 MB 0.43s
11.87 MB a70 1 10.63 MB 1.15s
1.00 2 10.62 MB 0.90s
11.87 MB a70 2 10.56 MB 3.32s
1.00 3 10.55 MB 2.59s

JPEG — lossy

JPEG — lossy (baseline)
infile id outfile time
11.87 MB a70 5.61 MB 1.51s
1.00 5.49 MB 1.06s
cmd mem dssim
a70 -jpgtype=0 in.jpg 503 MB 0.00071016
100 -q=92 -s1 in.jpg 302 MB 0.00070157
JPEG — lossy (progressive)
infile id outfile time
11.87 MB a70 5.38 MB 3.49s
1.00 5.38 MB 1.60s
cmd mem dssim
a70 -jpgtype=1 in.jpg 503 MB 0.00071016
100 -q=92 -s2 in.jpg 303 MB 0.00070157
JPEG — lossy (progressive)
infile id outfile time
11.87 MB a70 5.38 MB 3.50s
1.00 5.26 MB 2.59s
cmd mem dssim
a70 -jpgtype=2 in.jpg 503 MB 0.00071016
100 -q=92 -s3 in.jpg 305 MB 0.00070157

WebP — lossless

pingo -lossless in.webp
WebP — lossless
infile id s outfile time
551.86 KB a70 no savings 0.63s
1.00 549.59 KB 0.39s
a70 9 517.27 KB 1.39s
1.00 4 509.69 KB 0.95s
277.75 KB a70 no savings 0.29s
1.00 no savings 0.18s
a70 9 267.29 KB 0.64s
1.00 4 266.06 KB 0.45s
484.98 KB a70 no savings 0.72s
1.00 444.40 KB 0.43s
a70 9 439.12 KB 1.47s
1.00 4 439.18 KB 0.92s
888.35 KB a70 no savings 0.77s
1.00 830.02 KB 0.47s
a70 9 817.72 KB 1.75s
1.00 4 817.72 KB 1.27s

WebP — lossy

pingo -webp in.png
WebP — lossy
infile id outfile time
70.11 KB a70 25.03 KB 0.10s
1.00 22.22 KB 0.04s
327.66 KB a70 74.07 KB 0.19s
1.00 74.16 KB 0.18s
cmd mem dssim
a70 -webp 39 MB 0.00029655
100 -webp 39 MB 0.00026109

APNG — lossless

pingo -lossless in.png
APNG — lossless
infile id s outfile time
2.03 MB a70 b 1.42 MB 3.34s
1.00 4 1.41 MB 2.71s
573.99 KB a70 b 190.87 KB 2.13s
1.00 4 190.62 KB 1.68s

APNG — lossy

pingo in.png
APNG — lossy
infile id outfile time
427.10 KB a70 231.58 KB 1.39s
1.00 220.20 KB 0.34s
2.65 MB a70 1.41 MB 2.88s
1.00 1.36 MB 1.26s
cmd mem dssim
a70 in.png 145 MB 0.00016947
100 in.png 143 MB 0.00032573

flags — new behaviors

flag behavior
(none)

automatic compression level and type

changes
  • does not perform automatic PNG to JPEG conversion
  • does not perform automatic transformations (sRGB, rotation, etc.)
-s1 to -s4

compression level

changes
  • does affect compression level only
  • strategies from 1 to 4
-lossless

enable lossless mode

changes
  • would be required for lossless compression
  • could not be combined or affect some transformations
  • would ignore 16 bit per sample PNG
  • if combined with -rotate, rotation would be done only if perfect
-quality=N

quality factor — would override default heuristics

changes
  • less effect regarding the color quantizer
  • more balanced
-srgb

convert image data from ICC profiles

changes
  • would not be done automatically
  • could not be performed in lossless mode
-rotate

auto rotate JPEG according to the orientation flag

changes
  • would not be done automatically
  • if combined with -lossless, rotation would be done only if perfect
-resize

resize image with adaptive transforms

changes
  • use a faster, ready-to-go library instead of the precedent implementation
  • improved quality/size with pre/post processing

error

  error:
  -----------------------------------------------------------------
  incorrect command-line or processing
  -----------------------------------------------------------------

what this message means

patches

1.23.9 — 26/06/2024
improved PNG and WebP lossless further (palette)
improved alpha-p palette optimization
added already optimized palette from PNG heuristic for PNG > WebP lossless
changed already optimized palette from PNG (1.23.9)
fixed -s1 for mt-palette
fixed JPEG q heuristic for transforms
fixed near gray

1.23 — 21/04/2024
improved PNG lossless further (palette)
improved WebP lossless (palette)

1.22 — 18/04/2024
fixed & improved PNG lossless (palette)

1.21 — 15/04/2024
added lossy & keep alpha
fixed WebP lossy does not keep alpha with -noalpha
changed % considering processable files only
various code optimization

1.20 — 20/03/2024
improved grayscale+alpha lossless filtering
changed behavior of -hq=1 on flat
improved lossy on near-grayscale images
fixed critical-typo when grayalpha in fast lossless
fixed & improved fast lossless
fixed compression regression from c6
fixed crash

1.19 — 07/03/2024
small improvements for palette sorting (PNG/WebP)
fixed & improved near-lossless (-hq) (PNG/WebP)

1.18 — 27/02/2024
improved heuristic in auto (PNG/JPEG)
improved -grayline/scale
fixed -hq behavior
various code optimization

1.17 — 13/01/2024
changed grayscale formula + fixes

1.16 — 15/11/2023
fixed and improved auto with palette as input (PNG/WebP)

1.15 — 30/10/2023
fixed palette stuff 3 (PNG)

1.14 — 26/10/2023
fixed palette stuff 2 (PNG)

1.13 — 25/10/2023
fixed palette stuff (PNG)

1.12 — 22/09/2023
reintroduced near stuff -hq=N (PNG/JPEG/WebP)
improved lossless content-heuristic (PNG)

1.11 — 23/08/2023
improved -s0 lossless for paletted (PNG)			

1.10 — 22/08/2023
fixed handling of invalid APNG structure
improved conversion when using -grayscale and auto (APNG/PNG)
improved auto decisions (APNG/PNG/WebP)

1.09 — 01/08/2023
fixed incorrect APNG optimization (size)

1.08 — 25/07/2023
fixed filter in auto (WebP)

1.07 — 25/07/2023
fixed grayscale and lossy (JPEG/WebP)

1.06 — 08/07/2023
improved heuristics for truecolor even more (WebP)

1.05 — 07/07/2023
fixed rotation and lossy (JPEG/WebP)
fixed some heuristics & improvements for truecolor stuff (WebP)
improved default efficiency for lossless WebP (-s0)

1.04 — 06/07/2023
improved auto decisions (PNG/WebP)

1.03 — 23/06/2023
improved auto decisions (PNG/WebP)

1.02 — 19/06/2023
fixed metadata (copy)

1.01 — 19/06/2023
fixed metadata handler -nostrip

1.00 — 14/06/2023
initial 1.x release