Pingo crash (JPG)

Javi said on 04/06/2018


Pingo (0.96y) crashes trying to optimize this JPEG:


Cédric Louvrier said on 04/06/2018

thanks for the report, this should be fixed in 0.96y2. btw, this sample is nice enought to introduce an unfinished function in pingo that should work great here

you should not (have to) use this

JPG to PNG is rarely a good thing, mainly because of artifacts: if you have the unaltered image (before JPG), you should probably work from it instead. however, pingo could try to convert your *simple graphics* from JPG to PNG. it makes sense to combine -pngconvert with -pngpalette for smaller results

pingo -pngconvert -pngpalette image.jpg

the filter

i also added a simple image filter that transforms data to make it more compressible for paletted encoding. this could work on simple text/graphics. the filter's strength could go from 0 (no) to 12 (max): you have to find what is best for your images. on the sample you provided, you could try this

pingo -pngconvert=12 -pngpalette=1 image.jpg

in this command, -pngconvert=12 is how much the image is transformed while -pngpalette=1 sets the number of colors to very low. what you could expect on those kind of sample:

JPG to PNG, filter and palettetization
JPG PNG (from JPG)
bapp01f002.jpg bapp01f002.png
120 565 bytes 16 917 bytes

another sample (same settings)

JPG (45 671 bytes) :
PNG (12 533 bytes) :


  • the filter does not work on all samples
  • you should set the -pngconvert and -pngpalette levels for each sample
  • you can combine with -sN (N=0..8) to compress more
  • the results are not optimal, but could help some OCR tool probably

Javi said on 04/09/2018


I've installed the version 0.96z2 but now some images are allways compressed to the same size; the value of quality of compression is ignored (in PNG and JPG).




Javi said on 04/09/2018

BTW, this problem also affects the -grayscale param; it's ignored with some images.

Cédric Louvrier said on 04/10/2018

quality of compression is ignored

thanks, 0.96z3 should fix this. regarding PNG, it is expected that different quality values could have the same result

the -grayscale

same issue as above. however, note that pingo could not overwrite if grayscale is bigger

Javi said on 04/11/2018

Hi Cèdric,

The problem persists with some images, pe:



Cédric Louvrier said on 04/12/2018

thanks. i did not upload the good thing obviously, see 0.96z4

Santosh said on 07/03/2018

Thanks for creating such good tool.

Just pointing out, quality is ignored. Command:

pingo -pngquality=10-50 face.png


 pingo -pngquality=30-70 face.png

Create file in same size. Why?

Cédric Louvrier said on 07/03/2018

you have to set a fixed value. like this:

pingo -pngquality=70 face.png

Javi said on 09/05/2018


There is a bug converting JPEGs to grayscale using -jpgsample and/or -jpgquality.

The resulting image is distorted (if you use a -jpgquality value near 100 there is no distortion but the image will be in color).


pingo -jpgquality=85 -grayscale image.jpg
pingo -jpgsample=2 -grayscale image.jpg

I only tested this with latest version 0.98.10.

Cédric Louvrier said on 09/05/2018

should be fixed in 0.98.11, thanks for report

comment this