| Welcome to WebmasterWorld Guest from 126.96.36.199 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Pubcon Platinum Sponsor 2014|
|Resize and crop multiple images with ImageMagick|
Resize and crop multiple images with ImageMagick
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.
Better question is:
How to make copies of all files in the specific directory?
Something like: cp *.jpg w_*.jpg ?
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...
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