2

I want to process images in batches for uploading onto websites. I am looking for a script which will provide optimum compression with 1024x768 size using command line tools like Imagemagick etc.

Here is one that I did on MS Windows. Orginally It was 3008x2000. I used MS office picture manager to reduce the resolution to 1024x768 and the file size was around 600KB. Then I ran it through sea monster and the final outcome was 1024x768 resolution and the file size was 84 KB. Here is the picture:

photo of musicians

Using the same process with Imagemagick and smoosh.it gives a picture which has a size of 314 KB.

1
  • 1
    You should also include information about the type of image (e.g. photograph, screenshot, etc.) and whether or not you want to have some quality loss.
    – JanC
    Oct 29, 2010 at 10:43

2 Answers 2

2

The quickest way to get off the ground is to shoot for something lossless. Resizing obviously can't help but lose data but if you use something like imagemagik to resize, leave the end quality quite high (at least 90%).

To compress, you have several options but the one I've had most luck with is Yahoo's Smush.it. It's an online webservice which means you have to upload your images. However there's a nice Python tool called Smooshy that does all this for you.

This is a lossless operation that basically keeps re-compressing the images until they start to show wear. In some cases, it can make a huge difference to filesize.

The bonus over jpegoptim is you don't have to worry about quality (it's always as good as the original) and it supports all formats. It just takes a little longer and you're bound by Yahoo's terms and conditions (they probably own your soul if you use it, etc).

2
  • I just ran this over the famfamfam silk icons (used all over the internet). They started off with a collective size of 646.7KB and now they're 50KB smaller. A relative small saving but these were already well compressed.
    – Oli
    Oct 29, 2010 at 11:49
  • 2
    As these are PNGs I then ran them through pngcrush in -brute mode and that saved me another 3k over the whole batch. Strangely running it against the original set only saved me 1k (was 645k). So if you're dealing with PNGs, Smooshy then pngcrush.
    – Oli
    Oct 29, 2010 at 11:57
1

Using ImageMagik is quite easy

mogrify -path destination/path -resize x768 -quality 90 source/path/*.jpg

I've only defined height in the resize in order to ensure the image H/W ratio isn't altered, adjust quality parameter at will.

You must log in to answer this question.

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