Skip to main content
nighthawk2032
Participant
March 13, 2023
Question

detecting an image rotation orientation (not from it's EXIF, or size details)

  • March 13, 2023
  • 4 replies
  • 1211 views

I want to run batch photoshop script on a dataset of images.

I am looking for a photoshop scripting solution, that detects what is the rotation of a given image.

A. Image does not contain any EXIF information.

B. And I can not "guess" the orientation rotation from it's size -- cause it is varied across my images dataset.

So that I can rotate each image, into it's correct rotation view.

 

any ideas,. anyone?

This topic has been closed for replies.

4 replies

Participant
March 5, 2024

One approach is to identify prominent visual features or patterns within the image that indicate its orientation. For instance, you can look for specific shapes, lines, or text orientation. Utilize Photoshop's scripting functions to analyze these features and determine the correct rotation angle. This process may involve using image processing libraries, such as OpenCV, integrated with your scripting solution.

Stephen Marsh
Community Expert
Community Expert
March 14, 2023

As Photoshop doesn't have a Filter > CSI option, you will probably need to look further afield...

 

https://github.com/dsposito/auto-image-rotator

 

 

nighthawk2032
Participant
March 5, 2024

Sorry I managed to get back to this (in a year delay), and saw your reply only now.

 

Yesterday, I did setup an environment to run this github script.
I had high hopes it'll work (cause according to it's algorithm - rotating by detection of faces -- should have catched most of the images on my 120k+ dataset), but when running it - too many false positive rotations were made 😞

I guess, that either the dlib python library, was updated in this year+ gap -- and now can detect even rotated faces - Or something else caused this to happen.

 

If you have other leads for a solution please post them in this thread.

 

I did contact Adobe support, again, so they'd add such an AI batch content-aware orientation rotation procedure to one of their products. I think that in this AI boom we are experiencing - such a procedure can easily be a ANN trained procedure, which will catch all the cases (even those without faces in the images).

c.pfaffenbichler
Community Expert
Community Expert
March 13, 2023

Scripting access to Photoshop’s features that utilize some meaningful image analysis (face recognition for example) is limited.

I expect Select > Sky might prove useful if the images you are trying to process were taken outside. 

Select > Subject might be less useful, but naturally it depends on the images. 

c.pfaffenbichler
Community Expert
Community Expert
March 13, 2023

Please explain what you mean with the help of screenshots. 

 

B. And I can not "guess" the orientation rotation from it's size -- cause it is varied across my images dataset.

Do you mean landscape vs portrait or do you mean the actual image content?

In the latter case (edit: and in the absence of metadata) a Photoshop Script or plugin’s guess would not seem worse than yours. 

nighthawk2032
Participant
March 13, 2023

Images are arbirary rotated 180, 90, 0, -90.

Each image has it's own varied resolution. So I can not tell what is landscape or portrait.

I think that the "File>>Automate>>Crop and straighten"-- may solve that, but I don't need the cropping in that function. From my tests the cropping of this function cropped vital content of the image.

c.pfaffenbichler
Community Expert
Community Expert
March 13, 2023

If there is no meaningful metadata I don’t understand how you expect this to work exactly. 

Based on which information would Photoshop or a plugin determine the rotation? (To illustrate the problem just imagine a cropped photograph of someone doing a handstand.) 

 

Please post a couple of the images in question to clarify the situation.