3

I am looking for a way in which I can do a lossless compression of all images in a directory in a batch process. I don't want images to loose quality.

I am running this website Winni.in, for this if you check in google's pagespeed tool, it suggests you to optimize images using lossless compression. For new product's images I can make changes in my algorithm of image saving but for existing images of products I need a way by which I can run a command which can do lossless compression for all images of products residing in a directory.

EDIT: Please see this site report http://gtmetrix.com/reports/www.winni.in/PzJBF0rW

Here you can find optimize images point in 5th suggestion, there you can see it is listing number of jpeg images to losslessly compress. If you optimize your images from an online image optimization utility like kraken.io then this warning is gone.

2
  • What do you mean by "lossless compression"? It seems that right now your images are JPEGs, which is a lossy format...
    – fkraiem
    May 26, 2014 at 19:08
  • @fkraiem please see edit
    – Abhinav
    May 27, 2014 at 4:11

4 Answers 4

1

I do not think Google means you to compress the images. That simply will not work.

Instead it is suggested to switch on compression in your webserver.

See here: Google's PageSpeed help on Compression

2
  • server compression is already on, please see this link gtmetrix.com/reports/www.winni.in/PzJBF0rW here you will find optimize images suggestion that is 5th number suggestion, to losslessly compress images to decrease size of image
    – Abhinav
    May 27, 2014 at 4:03
  • 1
    @Abhi : Looking at the website you link to and their 5th suggestion, I can understand that they would advise to use .png instead of .gif. It's always a better idea to use .png. But how that site thinks that a .jpg is a lossless version of jpeg is beyond me. Next, given the improvement gain I wouldn't bother with that. Their 1st and 2nd suggestions might be more interesting, but when I then look at the absolute gains predicted (being at the kilobyte-level; remember that most people have megabyte/s connections) and considering the overall load-time of your site I wouldn't worry too much.
    – Mausy5043
    May 28, 2014 at 14:37
0

If you want to further compress your images or convert them to a different format which has a better compression ratio, you might want to look at the convert command.

It has loads of options.

0

jpegoptim performs lossless compression of JPEG images

optipng performs lossless compression of PNG images

0

If you're looking for image compression, I would recommend you Hummingbird plugin. It's the best plugin for image compression for websites.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .