Automatic Picture Sizing and Renaming

Robin Laing Robin.Laing at drdc-rddc.gc.ca
Tue Dec 12 20:49:55 UTC 2006


On Mon, 2006-12-11 at 22:55 -0500, Thom Paine wrote:
> 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
> 

Convert is part of ImageMagick and thus it's manual is useful.  There is
a way to have the files converted and renamed.  Look at mogrify instead.


http://www.linbox.com/ucome.rvt?file=/any/doc_distrib/ImageMagick-5.1.1/www/tools.html

Examples
http://www.cit.gu.edu.au/~anthony/graphics/imagick6/




More information about the fedora-list mailing list