"-orient" doesn't seem to work

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

"-orient" doesn't seem to work

Post by Drarakel »

"-orient" should update the EXIF orientation tag - right? If yes, then that option doesn't work at the moment.
Take that logo image, for example:
http://i.imagehost.org/0889/logo1.jpg

Code: Select all

convert logo1.jpg -orient BottomRight logo2.jpg
identify -format "%[EXIF:Orientation]" logo2.jpg
0
Should be '3' in that example. But whatever orientation is specified - the value is always reset to 0 (Undefined).
That wrong result can even be seen in the example in the documentation:
http://www.imagemagick.org/Usage/photos/#orient

Using IM v6.6.3-2 Q16, Windows XP.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: "-orient" doesn't seem to work

Post by fmw42 »

I confirm this on IM 6.6.3.2 Q16 Mac OSX Tiger:


convert logo: logo.png
identify -verbose logo.png
...
Orientation: Undefined


convert logo.png -orient bottomleft logo2.png
identify -verbose logo2.png
...
Orientation: Undefined
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: "-orient" doesn't seem to work

Post by fmw42 »

Not sure you have had time to address this, but it still exists in IM 6.6.3.3 Q16 Mac OSX tiger.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: "-orient" doesn't seem to work

Post by magick »

We can reproduce the problem you posted and have a patch in ImageMagick-6.6.3-4 Beta available by sometime tomorrow. Thanks.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: "-orient" doesn't seem to work

Post by fmw42 »

this still does not appear to work in IM 6.6.3.4 Q16 Mac OSX tiger



convert logo.png -orient bottomleft logo2.png
identify -verbose logo2.png
...
Orientation: Undefined

Am I missing something?
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: "-orient" doesn't seem to work

Post by Drarakel »

For me, it works now. Thanks!
fmw42 wrote:convert logo.png -orient bottomleft logo2.png
identify -verbose logo2.png
...
Orientation: Undefined

Am I missing something?
I think, "-orient" only updates the orientation tag. So, this works only if there is already an EXIF orientation tag in the input file.


Not sure if someone would notice it - but the documentation could be updated, too:
http://www.imagemagick.org/Usage/photos/#orient
The example "convert pagoda_sm.jpg -orient bottom-right -format '%[exif:orientation]' info:" should result in the value '3' now, not '0' (http://www.imagemagick.org/Usage/photos ... etting.txt).
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: "-orient" doesn't seem to work

Post by fmw42 »

I
think, "-orient" only updates the orientation tag. So, this works only if there is already an EXIF orientation tag in the input file.
This produces no result:

convert logo.png -orient bottomleft logo2.png
convert logo2.png -format '%[exif:orientation]' info:

Is this because of the reason stated above? Do I have to create a new exif tag for orientation before it will write the right value?
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: "-orient" doesn't seem to work

Post by Drarakel »

fmw42 wrote:Do I have to create a new exif tag for orientation before it will write the right value?
It seems so, yes.
You could test the commands with the file from the first post ('logo1.jpg'), for example. Before v6.6.3-4, the usage of "-orient" always resulted in value 0 (Undefined) when there was an orientation tag in the file. Now, the usage of this option works for these cases.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: "-orient" doesn't seem to work

Post by fmw42 »

Drarakel wrote:
fmw42 wrote:Do I have to create a new exif tag for orientation before it will write the right value?
It seems so, yes.
You could test the commands with the file from the first post ('logo1.jpg'), for example. Before v6.6.3-4, the usage of "-orient" always resulted in value 0 (Undefined) when there was an orientation tag in the file. Now, the usage of this option works for these cases.

Is it reasonable to assume/believe/desire that if one issued the command -orient, that if there was no orientation tag already, it would then create one, if needed? Is there any reason one might not want this behavior?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: "-orient" doesn't seem to work

Post by anthony »

fmw42 wrote:Is it reasonable to assume/believe/desire that if one issued the command -orient, that if there was no orientation tag already, it would then create one, if needed? Is there any reason one might not want this behavior?
That seems reasonable. But it would have to be clear in the documentation that this is what is happening.

This can be especially important to note when you give arguments like.. -strip -orient bottom-left Which I would then assume any old profile would be first junked, then a minimal new and mostly blank profile added.

However some other EXIF settings could conceivably bleed though into the new EXIF profile. For example labels, captions and comments, which are the three free-form plain text meta-data entries. Also density (resolution) Not certain which of these are also part of the EXIF profile, and which are stripped by -strip.

As such some careful though about EXACTLY what should happen is needed. Exactly What 'creates' a new profile?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: "-orient" doesn't seem to work

Post by fmw42 »

I understand. I was just raising this for discussion. If one wants to leave it alone, then it should be made clear that -orient won't be set unless there is a profile at least an exif tag set for it already.

I was hoping to hear back from people who make use of this more as I have not used it, yet, in my work.
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: "-orient" doesn't seem to work

Post by Drarakel »

fmw42 wrote:Is it reasonable to assume/believe/desire that if one issued the command -orient, that if there was no orientation tag already, it would then create one, if needed?
Sure - that would be preferable for me, too.
Post Reply