Image
An alternative would be the picture, via terminal using the image-cli or if you prefer via imagemin-app, but the latter does not work as well (by the tested version). There is also the possibility via Grunt or Gulp.
If used via terminal imagemin-cli
:
# instalar o imagemin via npm
npm install -g imagemin-cli
# optimizar todas as imagens JPG/PNG/SVG de uma pasta
imagemin pasta_com_images/* -o pasta_de_destino/
Using the reference images (see below) for comparison it is found that:
c-1920.jpg
had a reduction of 6,7%
pia01969-saturn-voyager1.png
had a reduction of 11,8%
Imageoptim
Another alternative only for bitmap images, would be the Imageoptim, via terminal using the Imageoptim-cli or if you prefer via imageoptim for MAC OS, or to other platforms. There is also the possibility via Grunt or Gulp.
If used via terminal imageoptim-cli
:
# instalar via npm
npm install -g imageoptim-cli
# optimizar todas as imagens JPG/PNG de uma pasta
imageoptim -d ./pasta_com_images/
Using the reference images for comparison, it is found that:
c-1920.jpg
had a reduction of 21,1%
pia01969-saturn-voyager1.png
had a reduction of 10,7%
Summary
By this small experiment Imageoptim reduced the JPEG image considerably more than Imagemin (21.1% instead of 6.7%). On the other hand, the PNG image was close, obtaining a better reduction (11.8% instead of 10.7% of Imageoptim). On the other hand, the imagemin also optimizes SVG images.
For the comparison made it was using the source images JPG and PNG used in the Lacobus response.
For other examples see the following comparison
I hope you help someone!
Relevant link: Optimizing
– Don't Panic