homepage Welcome to WebmasterWorld Guest from 50.19.206.49
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
Resize and crop multiple images with ImageMagick
Resize and crop multiple images with ImageMagick
sunroof




msg:3648254
 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.

 

sunroof




msg:3648281
 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 ?

physics




msg:3648313
 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...

Sharper




msg:3652712
 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved