Batch image resize

for a in `ls`; do echo $a && convert $a -resize <Width>x<Height> $a; done
Resizes all images in the curent directory to x resolution. It is better than `mogrify -resize *.jpg` because of independence from extension of image (e.g. .jpg and .JPG) (:
Sample Output

What Others Think

`ls` is bug-prone, just use * if you care about case, use *.[jJ][pP][gG] or more sanely, find . -maxdepth 1 -iname '*.jpg' | while read a; do convert ...; done
eichin · 672 weeks and 6 days ago
You don't need ls to discover files. By default your shell should expand `*` to every file name, or `*.jpg` to every jpg file in the current directory. Here's another way based on eichin's version: find . -maxdepth 1 -iregex ".*\.jpe?g" -exec convert {} -resize WxH {} \; will match jpg/JPG/jpeg/JPEG.
bwoodacre · 672 weeks and 6 days ago
Notice that if you are using linux (don't know about Win) only the solution proposed by bwoodacre will work for filenames with a space inside.
javier · 657 weeks and 3 days ago
I just found it. Wouldn't be better to use mogrify? mogrify -sample 50% *.jpg
javier · 657 weeks and 3 days ago
When you add content with images to your website, you may find that your pictures are too large, either in dimensions or in file size. This is a problem because large images take longer to load on the page, slowing down the performance of your site. Most of the people are having best parental control app for all devices so that they could take control on their children's activities.
PaigeRandall · 16 weeks and 2 days ago
At this point you'll find out what is important, it all gives a url to the appealing page: Orlando Bed Bug Treatment
CalvinVasquez · 14 weeks and 5 days ago
There you can download for free, see the first of these data. Orlando Pest Control
CalvinVasquez · 14 weeks and 1 day ago
it's really nice and meanful. it's really cool blog. Linking is very useful have really helped lots of people who visit blog and provide them usefull information. Tampa Pest Control
CalvinVasquez · 14 weeks and 1 day ago
I personally use them exclusively high-quality elements : you will notice these folks during:">restaurant
CalvinVasquez · 13 weeks and 2 days ago
I might suggest solely beneficial in addition to trusted facts, and so find it:">Cad Design
CalvinVasquez · 13 weeks and 2 days ago
These you will then see the most important thing, the application provides you a website a powerful important internet page:">Balayage
CalvinVasquez · 13 weeks and 2 days ago
Find the best essays on is my friend's profile page.">Supima
CalvinVasquez · 13 weeks and 2 days ago
It's superior, however , check out material at the street address. india virtual phone number
CalvinVasquez · 12 weeks and 6 days ago
It is especially decent, though look into the tips during this home address. carton former
CalvinVasquez · 9 weeks and 2 days ago
Make the most of mainly premium substances - you will find him or her for: reptiles thermostat
CalvinVasquez · 4 weeks ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: