Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Batch Image compression tool for optimizing thousands of images [closed]

I'm maintaining a site that has thousands of images that have not been compressed nearly enough. The homepage weighs in at 1.5 Mb currently, and it could easily be way less that half that.

I'm looking for some kind of tool that'll take a folder full of JPG pictures and will recompress them to their "optimal" compression value.

Obviously, "optimal lossy compression setting" is an oxymoron, but I'm thinking maybe a tool that'll try different levels and compare the outputs to the input, and choose a "sweet spot" between size and destruction?

Or even try whether PNG is a better option, many times it is, for "drawing" type stuff.

Does anyone of you know any such tool?
I'd have lots of fun coding one, but I bet someone already did and will save me 2 days.

Alternatively, of course, anything that'll take all pictures in a folder and recompress them with a fixed quality level (say, 40) will also work, it'll just not make my inner nerd as happy, but it'll solve my problem just fine.

(Ideally something that can run on Windows, ideally from the command line)

Thank you!

like image 488
Daniel Magliola Avatar asked Jun 09 '10 23:06

Daniel Magliola


People also ask

How do I optimize photos in bulk?

To bulk optimize images via the media library, select all of the images you would like to optimize from the library view and choose Optimize Images from the drop down. Then click Apply. This will take you to the optimization page where your selected images will be optimized one-by-one.

How do you compress your images to optimize performance?

Choose the file format most appropriate for the desired visual impact. Use progressive JPEGs and next gen file formats to ensure images load faster. Utilize caching both on the client and server side to eliminate wasteful image re-loading. Use compression to reduce file size without noticeably affecting quality.

What is the best compression method for images?

The DCT is sometimes referred to as "DCT-II" in the context of a family of discrete cosine transforms (see discrete cosine transform). It is generally the most efficient form of image compression. DCT is used in JPEG, the most popular lossy format, and the more recent HEIF.


1 Answers

I used ImageMagick for that purpose. It consist of a lot of things, among which a set of commandline tools that can be used to chain image operations along each other.

It is fun to experiment on the commandline, copy it in a script and let it rip over a couple thousand images. I found the default quality of the resulting images also pretty good.

Here is the website. I used it under Linux, but I saw there is a windows version too.

like image 185
Peter Tillemans Avatar answered Nov 10 '22 13:11

Peter Tillemans