SurfahBoy808 Posted January 23, 2005 Share Posted January 23, 2005 ok, I have a directory of jpg's. Instead of opening them up one by one in the gimp and resizing them, how do I resize a whole directory by file type? I know there's a way but I'm missing something in my command. I would imagine that this would be helpful if someone had a directory of more than 10. so far, the closest I got were these 2 different commands which did the same thing. They both created a set of resized images and 2 sets of duplicates of the original size. What am I missing? mogrify -size 3072x2048 -resize 800x600 +profile "*" *.jpg convert -size 3072x2048 *.jpg -resize 800x600 *.jpg [moved from Tips & Tricks by spinynorman] Link to comment Share on other sites More sharing options...
iphitus Posted January 23, 2005 Share Posted January 23, 2005 #! /bin/bash DIRECTORY=/home/joe/images for format in 'jpg' 'png' do for image in `ls $DIRECTORY/*$format` do convert -resize 800x600 $DIRECTORY/$image done done that's a quick script, should work.. put it whereever, change DIRECTORY, then run it and it *should* work, i havnt got anything to test on. any bets aru upstages me with a one liner ;) Link to comment Share on other sites More sharing options...
Steve Scrimpshire Posted January 23, 2005 Share Posted January 23, 2005 find . -iname "*.jpg" -exec sh -c 'convert -size 800x600 "${1}" -resize 800x600 +profile "*" "${1//.jpg/-new.jpg}"' {} {} \; or just find . -iname "*.jpg" -exec sh -c 'convert -size 800x600 "${1}" -resize 800x600 +profile "*" "${1}"' {} {} \; if you don't want to save the old one. Link to comment Share on other sites More sharing options...
SurfahBoy808 Posted January 24, 2005 Author Share Posted January 24, 2005 Thanks for your replies guys. The only one out of the 3 that worked was this code. How would I make the new images overwrite the old ones? do I just take out the -new part? find . -iname "*.jpg" -exec sh -c 'convert -size 800x600 "${1}" -resize 800x600 +profile "*" "${1//.jpg/-new.jpg}"' {} {} \; Link to comment Share on other sites More sharing options...
Steve Scrimpshire Posted January 24, 2005 Share Posted January 24, 2005 find . -iname "*.jpg" -exec sh -c 'convert -size 800x600 "${1}" -resize 800x600 +profile "*" "${1}" && echo "`basename ${1}` resized"' {} {} \; This one works. I've tested it. Copy and paste it. This one will overwrite the old. All I did was add echoing some output so you can see that it is doing something. Link to comment Share on other sites More sharing options...
SurfahBoy808 Posted January 25, 2005 Author Share Posted January 25, 2005 cool Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now