| Welcome to WebmasterWorld Guest from 18.104.22.168 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Become a Pro Member|
|Resize and crop multiple images with ImageMagick|
Resize and crop multiple images with ImageMagick
| 8:59 pm on May 12, 2008 (gmt 0)|
I need to resize and crop all images in the specific directory using linux command line and ImageMagick.
I have a directory with 100K jpg images dimensions 264x198 pixels, which need to be resized to 176 pixels width and cropped to 176x110 from the top. The original images should be left as they are.
I can manualy resize and crop one image at a time with these two commands:
convert -resize 176 000000001.jpg w_000000001.jpg
convert -crop 176x110+0+0 w_000000001.jpg
How can I do this for all images (*.jpg) in the current directory?
Thanks a lot.
| 9:17 pm on May 12, 2008 (gmt 0)|
Better question is:
How to make copies of all files in the specific directory?
Something like: cp *.jpg w_*.jpg ?
| 10:12 pm on May 12, 2008 (gmt 0)|
You could do this with a perl script or a shell script. Shell might be:
for x in `ls *.jpg`; do `convert -resize 176 $x w_$x; convert -crop w_$x`; done
To simply make a copy is similar to the above...
| 7:21 pm on May 17, 2008 (gmt 0)|
Imagemagick already has a tool designed for batch processing of images, mogrify.
See [imagemagick.org...] for exact details.
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved