How to detect orentation of an image inan action

G
Posted By
Grebo
Feb 27, 2007
Views
950
Replies
15
Status
Closed
I want to write an action that works on and can detect if the image is landscape or portrait.

The Break down is

If portrait then set the image height to 400px
If portrait then set the image width to 400px

Set the canvas size = 410 X 410

Then there is other processing to be done…
The rest I can do no Problems

How to Master Sharpening in Photoshop

Give your photos a professional finish with sharpening in Photoshop. Learn to enhance details, create contrast, and prepare your images for print, web, and social media.

AM
Andrew Morton
Feb 27, 2007
wrote:
I want to write an action that works on and can detect if the image is landscape or portrait.

The Break down is

If portrait then set the image height to 400px
If portrait then set the image width to 400px

Assuming you meant "If landscape" for the last one… File->Automate->Fit Image… and set each dimension to 400px.

Set the canvas size = 410 X 410

Image->Canvas Size… – you may need to set the canvas extension background colour.

Andrew
J
jls
Feb 27, 2007
On Tue, 27 Feb 2007 08:54:06 -0000, "Andrew Morton" wrote:

wrote:
I want to write an action that works on and can detect if the image is landscape or portrait.

The Break down is

If portrait then set the image height to 400px
If portrait then set the image width to 400px

Assuming you meant "If landscape" for the last one… File->Automate->Fit Image… and set each dimension to 400px.
Set the canvas size = 410 X 410

Image->Canvas Size… – you may need to set the canvas extension background colour.

Andrew

Hmm… for me, I just avoid rotating "portrait"-oriented pictures. That way, all my pictures are always oriented in the same direction in Photoshop and all my actions just work.

If I’m printing, it never matters anyway. If I want it for web viewing, I can always rotate the portrait-oriented ones myself as a final step (e.g., put all of them in a separate folder and have an action that rotates all of the images in that folder and outputs to a new folder).
M
MetaMorph
Feb 27, 2007
If you are talking about Dig. camera images… I have been thinking about this too – what is REALLY required is for the camera software to write a bit to the EXIF information for each file. This bit ought to be 0 if the camera is held in landscape mode and 1 if in portrait mode, for example.

To ascertain which is which – I would suggest a simple tilt device in the camera body which could detect the rotation angle – in fact a more complex piece of kit could tell exactly what angle the camera is being held at and then that information oughtt to go in the Files EXIF info..

The Application software would of course then have to read this data from the EXIF information to determine whether the image was portrait or landscape.

This would save an awful lot of tilting ones head when viewing images on a TV screen, for instance, where image rotation may not be available… Would help in other ways too of course..

Just a thought!!
RB
Rudy Benner
Feb 28, 2007
"MetaMorph" wrote in message
If you are talking about Dig. camera images… I have been thinking about this too – what is REALLY required is for the camera software to write a bit to the EXIF information for each file. This bit ought to be 0 if the camera is held in landscape mode and 1 if in portrait mode, for example.
To ascertain which is which – I would suggest a simple tilt device in the camera body which could detect the rotation angle – in fact a more complex piece of kit could tell exactly what angle the camera is being held at and then that information oughtt to go in the Files EXIF info..
The Application software would of course then have to read this data from the EXIF information to determine whether the image was portrait or landscape.

This would save an awful lot of tilting ones head when viewing images on a TV screen, for instance, where image rotation may not be available… Would help in other ways too of course..

Just a thought!!

This is nothing new, many cameras already utilize this. Many software suites also use this.
N
nomail
Feb 28, 2007
MetaMorph wrote:

If you are talking about Dig. camera images… I have been thinking about this too – what is REALLY required is for the camera software to write a bit to the EXIF information for each file. This bit ought to be 0 if the camera is held in landscape mode and 1 if in portrait mode, for example.
To ascertain which is which – I would suggest a simple tilt device in the camera body which could detect the rotation angle – in fact a more complex piece of kit could tell exactly what angle the camera is being held at and then that information oughtt to go in the Files EXIF info..
The Application software would of course then have to read this data from the EXIF information to determine whether the image was portrait or landscape.

This would save an awful lot of tilting ones head when viewing images on a TV screen, for instance, where image rotation may not be available… Would help in other ways too of course..

Just a thought!!

Almost every modern digital camera has this option already, and in fact, that is exactly why the OP has his problem. Because the images are rotated already, he needs to use ‘Fit Image’ to resize them because there are portrait and landscape images.


Johan W. Elzenga johan<<at>>johanfoto.nl Editor / Photographer http://www.johanfoto.com
M
MetaMorph
Feb 28, 2007
Are you saying some digital cameras’ embedded software writes a status word to the files exif information so that application software can tell whether its a portrait or landscape image? If so – which cameras and what is the status word/bit?
G
GordonG
Mar 1, 2007
MetaMorph wrote:
Are you saying some digital cameras’ embedded software writes a status word to the files exif information so that application software can tell whether its a portrait or landscape image? If so – which cameras and what is the status word/bit?

My Canon digitals have always had this ability. They use a sensor in the camera to detect which way is up (I understand it’s a small metal ball in a curved tube)and my downloading software – Breeze Systems Downloader Pro – can orient the picture correctly. Don’t ask me which EXIF bit it is, though. I’m a photographer, not a programmer 🙂
N
nomail
Mar 1, 2007
MetaMorph wrote:

Are you saying some digital cameras’ embedded software writes a status word to the files exif information so that application software can tell whether its a portrait or landscape image? If so – which cameras and what is the status word/bit?

Yep, that’s what I’m saying. Not ‘some’ cameras, almost every modern camera has this ability. Perhaps the very cheap ones don’t, but the rest do. It’s not a word, it’s two bits in the EXIF data. The first bit tells if an image should be rotated or not. The second bit tells in which direction (+90° or -90°).


Johan W. Elzenga johan<<at>>johanfoto.nl Editor / Photographer http://www.johanfoto.com
M
MetaMorph
Mar 4, 2007
Johan and GordonG
Thanks for that information – I have fuji Digital cameras – 6500 and S7000 (and an ld 4900) – I will take a look – though I don’t appear ever have been given the option when opening a file is PS (or PSP), of rotating an image.. Maybe PS does not have this functionality (I have PS7)

cheers
RB
Rudy Benner
Mar 4, 2007
"MetaMorph" wrote in message
Johan and GordonG
Thanks for that information – I have fuji Digital cameras – 6500 and S7000 (and an ld 4900) – I will take a look – though I don’t appear ever have been given the option when opening a file is PS (or PSP), of rotating an image.. Maybe PS does not have this functionality (I have PS7)
cheers

send me a file — rudy at rudybenner dot com

I will email you back
M
MetaMorph
Mar 4, 2007
Rudy
Hi – thanks for the offer – but I looked in the EXIF information for 3 images from the 3 different cameras – there is nothing in there I can see

Cheers
RB
Rudy Benner
Mar 4, 2007
"MetaMorph" wrote in message
Rudy
Hi – thanks for the offer – but I looked in the EXIF information for 3 images from the 3 different cameras – there is nothing in there I can see
Cheers

http://www.takenet.or.jp/~ryuuji/minisoft/exifread/english/

I just checked 4 cameras, all have the orientation sensor and this shows on the exif data. Whether or not software uses it is another matter.

r.
M
Mike
Mar 5, 2007
In article <1hub4qm.d8j7k0vw4ve0N% says…
MetaMorph wrote:

Are you saying some digital cameras’ embedded software writes a status word to the files exif information so that application software can tell whether its a portrait or landscape image? If so – which cameras and what is the status word/bit?

Yep, that’s what I’m saying. Not ‘some’ cameras, almost every modern camera has this ability. Perhaps the very cheap ones don’t, but the rest do. It’s not a word, it’s two bits in the EXIF data. The first bit tells if an image should be rotated or not. The second bit tells in which direction (+90° or -90°).
Seems a little wasteful to me. With 2 bits of info they could have 0,+/-90, _and_ 180 degrees (just in case you were
holding the camera upside-down).

Mike
N
nomail
Mar 5, 2007
Mike wrote:

Yep, that’s what I’m saying. Not ‘some’ cameras, almost every modern camera has this ability. Perhaps the very cheap ones don’t, but the rest do. It’s not a word, it’s two bits in the EXIF data. The first bit tells if an image should be rotated or not. The second bit tells in which direction (+90° or -90°).
Seems a little wasteful to me. With 2 bits of info they could have 0,+/-90, _and_ 180 degrees (just in case you were holding the camera upside-down).

Except that I don’t think that the orientation sensor records that…


Johan W. Elzenga johan<<at>>johanfoto.nl Editor / Photographer http://www.johanfoto.com
M
MetaMorph
Mar 5, 2007
Hi again
Ok – thanks for that link – will take a look.

Another poster suggested this isn’t what the orientation sensor records, if not, what IS it?

MacBook Pro 16” Mockups 🔥

– in 4 materials (clay versions included)

– 12 scenes

– 48 MacBook Pro 16″ mockups

– 6000 x 4500 px

Related Discussion Topics

Nice and short text about related topics in discussion sections