Skip to main content

Tip : Optimize images on Ubuntu Linux

When working with a lot of images by example for galleries on a website, it could be really interesting to optimize the images to save a lot of space and directly improve the performances of the website and save some traffic if this is limited by your hosting.

Optimize JPEG images with jpegoptim

A great tool to optimize JPEG images is jpegoptim. It's a simple command line tool available as Ubuntu package. You can install it easily :

sudo apt-get install jpegoptim

And it's also really simple to use. First, to optimize an image without loss :

jpegoptim image.jpg

Or with a loss of max 25% :

jpegoptim --max=75 image.jpg

More informations on the official site.

Optimize PNG, BMP and GIF images with optipng

An other tool to optimize other types of images is optipng. Here again you can install it with apt-get :

sudo apt-get install optipng

It's as easy as the first tool :

optipng image.png

You can also configure the tool to use the best optimization level, but also the slowest :

optipng -o7 image.png

So here we are : You have now enough informations to optimize all you images on Ubuntu. I hope this will be useful to somebody.


Comments powered by Disqus