Tuesday, April 01, 2008

Batch croping images in Linux

I used this blog post: http://www.kriyayoga.com/love_blog/post.php/853

I was having a hard time with the for loop because of spaces in my file names. I tried this alternative and it worked. I'm not sure that I couldn't have gotten the for loop to work though, had I added the proper quotes.

find ./ -name '* *' | while read FILE; do convert "$FILE" -crop 487x370+386+281 "$FILE-cropped.jpg"; done

487x370 are the new image sizes. 386 and 281 are the offsets from the left and top borders.

No comments: