pingo a fast image optimizer for web
pingo is an experimental lossless and lossy image optimizer (PNG, JPEG, WebP, APNG) designed to be used for web context — it does image reductions over iterations by performing its own heuristics to target the image content. since most of features are not fully implemented, it would be recommended to do backup or use only on test files
usage (examples)
pingo [options] files/folders
pingo -s0 *.png
pingo -s0 myfolder
pingo -s0 c:\myfolder
PNG — lossless
pingo -sN file.png
the lossless PNG optimizer in pingo does heuristic ordered transforms to make the data more compressible losslessly for web. it performs an highly optimized deflation according to the user-level. see also the PNG lossless benchmark — -sa or -sb do more trials, -fast=N does faster encoding
JPEG — lossless
pingo -sN file.jpg
the JPEG lossless optimizer in pingo is just like mozjpeg with some automatic transform on image data — rotation according to the orientation flag. instead of using the automatic lossless profile, user could add jpgtype=N to force the encoding
-jpgtype=0, baseline: fast encode and fast decode, legacy compatible but usually do less savings
-jpgtype=1, progressive: average encode speed but slower decode, usually better savings than baseline
-jpgtype=2, progressive with more scans: slow encode, slower decode, usually best savings
WebP — lossless
the WebP lossless optimizer uses a tweaked libwebp — it could try its own heuristics to determine transformations. this implementation is incomplete at this moment: it makes sense to try it on paletted samples where it uses a different way to sort colors
APNG — lossless
the APNG optimizer would try to re-create the animation by using some transformations. this implementation is incomplete at this moment: it could not be able to select an optimal colortype or bitdepth
PNG — lossy
pingo would let the user to try several lossy transformations for PNG. it makes sense to use those transformations from high quality source — not to apply those several times on the same file
-auto or -auto=N
N = 1 to 100 as quality factor: 1 = very low, 100 = best effort. this would attempt to optimize the file automatically, by picking the lossy transformation (eventually lossless) by itself. this implementation is incomplete at this moment: it uses only fast heuristics which could be wrong
-pngfilter or -pngfilter=N
N = 1 to 100 as quality factor: 1 = low, 100 = near-lossless. this would try to transform image data using predictors. would be efficient on image with lot of colors / noise, and less efficient on low colored images
-pngpalette or -pngpalette=N
N = 1 to 100 as quality factor: 1 = very low, 100 = best effort. this would try to transform image data by palettization. would be efficient on low colored images, and could have limitations for high colored ones
pingo -pngpalette — lossy palettization
| infile |
outfile |
time |
| 189,75 KB |
8,66 KB |
0,11s |
-pngcolor or -pngcolor=N
N = 1 to 100 as quality factor: 1 = low, 100 = near-lossless. this would try to reduce image data using color transformation. this usually get the closest near-lossless
result if used with highest value, but could do less savings; could be also useful on moderately colored images
pingo -pngfilter — lossy color transform
| infile |
outfile |
time |
| 102,93 KB |
63,64 KB |
0,14s |
JPEG — lossy
the JPEG lossy uses sjpeg — it does 4:4:4 by default, with automatic settings according to the sample. eventually, user could set the following flag:
-jpgquality=N
N = 1 to 100 as quality factor: 1 = low, 100 = best effort. without any other flag, it should not try to do subsampling, unless source is already 4:2:0 JPEG
-jpgsub
this would enable the JPEG subsampling but by using a sharp filter on high quality source. this attempt could offer a better rendering than regular subsampling
WebP — lossy/auto
the WebP lossy optimizer in pingo uses sharp_yuv by default on high quality source. it could give different results from the reference encoder — e.g. image pre-processing on PNG with alpha, automatic compression, etc.
-webp-lossy or -webp-lossy=N
N = 1 to 100 as quality factor: 1 = low, 100 = best effort
pingo -webp-lossy=N — WebP lossy with alpha pre-processing
| infile |
outfile |
time |
| 227,86 KB |
100: 40,53 KB |
0,07s |
84: 20,08 KB |
0,06s |
-webp or -webp=N
N = 1 to 100 as quality factor: 1 = low, 100 = best effort. just like -auto, it would pick a transform according to the image data, including a lossless one if it seems more suitable. this implementation is incomplete at this moment: it uses only fast heuristics which could be wrong
pingo -webp — WebP automatic lossy compression
| infile |
outfile |
time |
| 634,71 KB |
13,00 KB |
0,08s |
pingo -webp — WebP automatic lossless compression
| infile |
outfile |
time |
| 171,02 KB |
7,07 KB |
0,13s |
-webp-palette or -webp-palette=N
N = 1 to 100 as quality factor: 1 = low, 100 = best effort. just like -pngpalette, this would try to transform image data by palettization
pingo -webp-palette=100 — WebP palettization
| infile |
outfile |
time |
| 18,91 KB |
10,78 KB |
0,09s |
WebP — near-lossless
if -webp-lossy has some limitations (YUV420) regarding quality, one could try a near-lossless transform instead. pingo includes several way to do this according to the sample
-webp-near or -webp-near=N
N = 1 to 100 as quality factor: 1 = low, 100 = best quality. this is a slighlty tweaked version from the one in libwebp
-webp-color or -webp-color=N
N = 1 to 100 as quality factor: 1 = low, 100 = best quality. use color transformation: it should be faster than -webp-near but could be less efficient on various image type. provide different quality/size ratio — not always better
pingo -webp-color=100 — WebP near-lossless, by color transform
| infile |
outfile |
time |
| 231,19 KB |
107,51 KB |
0,18s |
-webp-filter or -webp-filter=N
N = 1 to 100 as quality factor: 1 = low, 100 = best quality. use predictors to transform data: only efficient on image with lot of colors, probably less efficient than -webp-color
pingo -webp-color=100 — WebP near-lossless, by color transform
| infile |
outfile |
time |
| 231,19 KB |
108,23 KB |
0,20s |
-webp-nigh or -webp-nigh=N
just like -auto, but would pick a near-lossless transform automatically according to the sample. this implementation is incomplete at this moment: it uses only fast heuristics which could be wrong
-fast=N
N = 1 to 4. -fast=1 works with -sN and could be combined with other lossy transforms (as grayscale, resize, pngfilter, etc.) and affects (A)PNG, JPEG or WebP. 2, 3 and 4 are only for PNG lossless encoding
pingo -fast=2 — fast PNG lossless compression
| infile |
outfile |
time |
| 6,35 MB |
5,08 MB |
0,29s |
pingo -fast=1 -pngfilter — fast PNG lossy compression
| infile |
outfile |
time |
| 6,35 MB |
2,50 MB |
0,58s |
color profiles
pingo converts image data to sRGB by perceptual intent from the color profile if a lossy transformation is done, whatever the format — it could be disabled by using -nosrgb. once converted, the color profile would be removed from the optimized file. this would also convert CMYK JPG
PNG
pingo -s0 — no transformation, copy the ICC colors profile
| infile |
outfile |
time |
| 218,46 KB |
154,20 KB |
0,25s |
pingo -s0 -strip — no transformation, strip the ICC colors profile
| infile |
outfile |
time |
| 218,46 KB |
153,87 KB |
0,29s |
pingo -auto — transform to sRGB, strip the ICC colors profile
| infile |
outfile |
time |
| 218,46 KB |
76,09 KB |
0,24s |
JPEG
pingo -jpgconvert — transform to sRGB, strip the ICC colors profile
| infile |
outfile |
time |
| 218,46 KB |
19,00 KB |
0,05s |
WebP
pingo -webp — transform to sRGB, strip the ICC colors profile
| infile |
outfile |
time |
| 218,46 KB |
37,13 KB |
0,10s |
-strip
even without using -strip, pingo would remove most of non-critical chunks/segments from PNG/JPG except some, as colors profile, which could be useful or affect rendering. -strip would be more strict
, and should leave only critical data
-resize=N
N = 24 to 1920. a downscaler that resizes PNG, JPEG, or WebP from the highest value of width/height and keep ratio (from height only for APNG). value must be inferior to the image — resizing is always done *with* an additional targeted lossy transform
PNG
pingo -resize=800 — in: 2471 x 3017 — out: 655 x 800
| infile |
outfile |
time |
| 8,56 MB |
453,04 KB |
0,79s |
pingo -resize=800 — in: 1600 x 1600 — out: 800 x 800
| infile |
outfile |
time |
| 46,67 KB |
26,50 KB |
0,26s |
JPEG
pingo -resize=1920 — in: 30000 x 12549 — out: 1920 x 803
| infile |
outfile |
time |
| 8,30 MB |
462,14 KB |
0,79s |
WebP
pingo -resize=800 — in: 1024 x 972 — out: 800 x 759
| infile |
outfile |
time |
| 1,93 MB |
90,07 KB |
0,24s |
-enhance or -enhance=N
N = 1 to 8 as factor: 1 = low, 8 = high sharpness. increase image details in some area while transforming image data to make it more compressible. this implementation is incomplete at this moment: it uses only fast heuristics
pingo -enhance — enhance details and compression
| infile |
outfile |
time |
| 435,40 KB |
248,46 KB |
0,13s |
-grayscale
convert image data to grey level. used with -sN in non-automatic mode, it should try to convert image with no loss over the transform. used in automatic mode, it would try to apply loss over the grey level conversion
PNG
pingo -grayscale -s0 — convert to grayscale *without* additional loss
| infile |
outfile |
time |
| 171,02 KB |
146,40 KB |
0,15s |
pingo -grayscale — convert to grayscale *with* additional loss
| infile |
outfile |
time |
| 171,02 KB |
102,71 KB |
0,16s |
JPEG
pingo -grayscale -s0 — convert to grayscale *without* additional loss
| infile |
outfile |
time |
| 147,27 KB |
62,05 KB |
0,03s |
pingo -grayscale — convert to grayscale *with* additional loss
| infile |
outfile |
time |
| 147,27 KB |
11,48 KB |
0,05s |
WebP
pingo -grayscale -s0 — convert to grayscale *without* additional loss
| infile |
outfile |
time |
| 171,02 KB |
114,16 KB |
0,15s |
pingo -grayscale — convert to grayscale *with* additional loss
| infile |
outfile |
time |
| 171,02 KB |
95,16 KB |
0,19s |
APNG
pingo -grayscale — convert to grayscale *with* additional loss
| infile |
outfile |
time |
| 84,60 KB |
47,01 KB |
0,28s |
-notrans
transform image data to make it non-transparent by colors blending. in automatic mode, this could convert PNG to JPG (could be disabled by adding -sN). user could set -notrans=N N N, where N is R, G, and B color value from 0 to 255 (default is 255,255,255 (white))
pingo -notrans -s0 — color blending, *without* additional loss
| infile |
outfile |
time |
| 761,38 KB |
351,90 KB |
0,14s |
pingo -notrans — color blending, conversion from PNG to JPEG
| infile |
outfile |
time |
| 761,38 KB |
52,71 KB |
0,09s |
-svgz or -svgz=N
N = 1 to 100 as quality factor: 1 = low, 100 = near-lossless. convert PNG images with lot of colors to compressed SVG container — this have to be served accordingly, but could be used in most of browsers (~2011). could be useful where recent codecs are not supported. -nocompression creates SVG files instead of SVGZ