La Vita è Bella

Wednesday, March 21, 2007

Bash script: batch resize your photos

If you toke some photos by your camera, and want to post them to somewhere (for example, I want to post the photo of my Treo 650 because I'm going to sell it), you may need to batch resize your photos.

This bash script shows how to uses ImageMagick to batch resize your photos:

1 #!/bin/sh
2
3 for file in *.JPG; do
4         convert -resize 1024x768 $file ${file%.JPG}_resize.jpg
5 done



tags: , , , ,

21:28:36 by fishy - linux - Permanent Link

Revision: 1.0/1.0, last modified on 2007-03-20 @ 22:28.

Karma: 29 (59.60% out of 151 were positive) [+/-]

You can subscribe to RSS 2.0 feed for comments and trackbacks

Trackbacks:
There are currently no trackbacks for this item.
Use this TrackBack url to ping this item (right-click, copy link target). If your blog does not support Trackbacks you can manually add your trackback by using this form.

nate beaty

nate beaty wrote:

wow, so simple w/ imagemagick. thanks for posting this. i did:

<code>
#!/bin/sh
for file in *.jpg; do
convert -resize '400x300>' -quality 70 +profile "*" $file ${file%.jpg}_sm.jpg
echo $file resized
done
</code>

to strip profile and the '>' makes sure it doesn't upsize a smaller img.

Tuesday, June 12, 2007 09:43:18

Add Comment

 

May the Force be with you. RAmen