Automatic Picture Sizing and Renaming

Thom Paine painethom at gmail.com
Tue Dec 12 03:55:05 UTC 2006


I have several hundred pictures I'd like to resize to 800x600 and I'd
also like to randomize their names to have them shuffle on a computer
screen for a screensaver.

I've been reading a bit and have some of a command figured out.

#convert -interlace NONE -geometry 800x600
/home/workgroup/pics/image1.jpg
/home/workgroup/pics/image1.resized.jpg

I'm not sure how to get this to work on a whole directory full of pictures.
Should I run this in some sort of a while do loop? I'm a rookie with
bash, but have been reading a bit trying to understand it.

Since I want them all to be random, is it better to rename them all
first with a random number between 1000 and 1999 with pic in front or
should I resize them first, delete the bigger original (because it
will be a copy) and then rename them? And what happens if I happen to
already have a picture named that?

Can anyone give me some help with scripting this up to work automatically?

Preferably I'd like these features.

1. Take all images in a source directory and convert them to 800x600 resolution.
2. Rename all images in said source directory to a random number
between 1000 and 1999 and then have the image name come out something
like pic1717.jpg
3. Delete the images in the source directory making room for another
batch to convert and display.

Thanks.

-- 
-=/>Thom




More information about the fedora-list mailing list