convert -auto-orient

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
Torava
Posts: 2
Joined: 2011-06-15T05:32:35-07:00
Authentication code: 8675308

convert -auto-orient

Post by Torava »

Hello!

I have tried to fix my pictures' orientation using convert command with no luck. identify command tells me that in my picture's orientation is undefined and exif orientation is some value. convert img.jpg -auto-orient only changes exif orientation to 0, but doesn't have effect on image. Using jhead -autorot img.jpg I get my pictures fixed and it sets exif orientation to 1, but I would like to use convert. Why this isn't possible to do with convert command?

I have ImageMagick 6.3.7.
Last edited by Torava on 2011-06-15T10:54:40-07:00, edited 2 times in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert -auto-orient

Post by fmw42 »

I cannot say what is going on but your version of IM is about 350 version old. Perhaps you should upgrade and try again.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: convert -auto-orient

Post by anthony »

Did you actually save the image? What was your command line?

See IM examples, Photo handling, Digital Photo Orientation
http://www.imagemagick.org/Usage/photos/#orient
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Torava
Posts: 2
Joined: 2011-06-15T05:32:35-07:00
Authentication code: 8675308

Re: convert -auto-orient

Post by Torava »

anthony wrote:Did you actually save the image? What was your command line?

See IM examples, Photo handling, Digital Photo Orientation
http://www.imagemagick.org/Usage/photos/#orient
I have saved many images using convert command. None of those have even been oriented. I have used PHP and PuTTY. Using PHP I resize images and save them to cache directory and want them to be oriented correctly.
fmw42 wrote:I cannot say what is going on but your version of IM is about 350 version old. Perhaps you should upgrade and try again.
I have no permissions to update ImageMagick so I have to wait until my host will do it.

Other question: What do you suggest if I want to name my resized images by new width? Like img_150px.jpg. Can I do that in one line?
Last edited by Torava on 2011-06-18T04:59:35-07:00, edited 2 times in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert -auto-orient

Post by fmw42 »

With your old version, not so easy. With a newer version you can use -set filename to get the image size and then use it in your output name.

something like:

convert image -set filename:mywidth "%[fx:w]" output_%[filename:mywidth].jpg

eg
convert rose: -set filename:mywidth "%w" rose_%[filename:mywidth].jpg

For older systems:

convert rose: rose_$(convert rose: -format "%w" info:).jpg
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: convert -auto-orient

Post by anthony »

NOTE: thumbnail images, either in the image as a preview, or already generated and stored by the operating system, will be affected by the rotation correction. As such you may not see it with a quick overview.

Also I do not recommend saving JPEG images back to JPEG! as you will get some distortion of image data every time you re-save to JPEG. It is a good format for disk space and web downloads, a bad format for preserving the image data.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply