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

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
mixersoft
Posts: 6
Joined: 2008-05-08T16:36:10-07:00

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

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
Post Reply