Page 1 of 1

Can you auto-Rotate, rename, resize in one step?

Posted: 2008-05-08T16:42:25-07:00
by mixersoft
I'm using the following to process my images

# autorotate from EXIF orientation, set filetime to EXIF date_taken
jhead -autorot -ft *.jpg

# create 640px preview, save a copy of preview subfolder
mkdir preview
mogrify -quality 85 -path ./preview -resize 640x640">" *.jpg

But what I really want is to have everything in imageMagick and in 1 command. And ideally, instead of saving the preview in a subfolder, save it with a prefix on the filename. Also, saving a third 75px square thumbnail would be the cats meow.

Can someone help me with the command?

TIA

Re: Can you auto-Rotate, rename, resize in one step?

Posted: 2008-05-08T22:56:29-07:00
by fmw42
I don't know enough about -auto-orient, but you can look at the following:

http://www.imagemagick.org/Usage/photos/#fix

It may not have enough controls for you. However, if it does, then all processing could be done in one step after you setup some parameters.

For example, something as follows where you can loop over all your input files in a script:

# define filename
infile="yourfilename.jpg"
# get the name without the suffix
inname=`convert $infile -format "%t" info:`
# process image
convert $infile \( +clone -auto-orient -write ${inname}_oriented.jpg \) \( +clone -resize 640x640 -quality 85 -write ${inname}_preview.jpg +delete \) -thumbnail 75x75 ${inname}_thumb.jpg

see
http://www.imagemagick.org/Usage/files/#write