... because from time to time I'm a web developer, too
About me
Projects
Contact
Links

Change quality of lots of images by one click :: linux

August 21, 2009 | linux, tools
author: Karol Zielinski | comments: 1 | views: 718
Tags: , , , , , , , ,

Did you ever try to change quality of lots of images? If you ever tried to put some images to your website – propably you did. How you can do it? Via Gimp, Photoshop, Paint, isn’t? Sure, you can. However… it takes so much time.

If you like to waste your time for boring things… you can always open each image via Gimp, press Ctrl+Shift+S, change quality by slider, etc. Yeah, that’s right – you can.

However… for all of you who want to spend free time doing much more interesting things, I recommend to use simple perl script.

Try to put this line into your linux console:


perl -e 'for (glob "*.jpg") { $img = $_; s/(....)$/$1_changed/; qx "convert $img -quality 80% $_"; }'

this line of code will reduce quality of all JPG files in our directory to 80% and save images with lower quality to files with suffix ‘_changed’.

and now… try to put this line of code:


perl -e 'for (glob "*.jpg") { $img = $_; s/(....)$/$1/; qx "convert $img -quality 80% $_"; }'

this line of code will reduce quality of all jpg files in our directory to 80% and replace original JPG files.

all you need to have is:

much easier, isn’t it?

Bookmark and Share
Post Change quality of lots of images by one click :: linux to develway Post Change quality of lots of images by one click :: linux to Delicious Post Change quality of lots of images by one click :: linux to Digg Post Change quality of lots of images by one click :: linux to Facebook Post Change quality of lots of images by one click :: linux to Reddit Post Change quality of lots of images by one click :: linux to StumbleUpon

Related news and resources

Comments (1)

4Avatars v0.3.1 v0.3.1
Mike
August 22, 2009, 11:04 pm

You can accomplish the goal of your first example without perl:

for f in *.jpg; do convert $f -quality 80% lowqual-$f; done

I prefer to save them in a new directory instead of messing with the filenames:

mkdir lowqual
for f in *.jpg; do convert $f -quality 80% lowqual/$f; done

When you don’t need the originals, just use mogrify:

mogrify -quality 80% *.jpg

Write a comment

Karol Zielinski :: Just a tech stuff Hello, I'm Karol Zielinski, internet evangelist, an entrepreneur, project manager and a web developer from Gdynia, Poland. I like creative design, good advertisement, social media and all kind of stuff around the web.

Most popular posts

Much more links

Karol Zielinski    |   contact me
Gdynia, Poland
RSS - Just a tech stuff - python, java blog - web development blog Karol Zielinski on twitter Karol Zielinski on LinkedIn Karol Zielinski on facebook Karol Zielinski on delicious Karol Zielinski on digg Karol Zielinski on flickr Karol Zielinski on stumbleupon Karol Zielinski on technorati