Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
It is a little difficult uploading screenshots, or the images,. these are family albums scanned images.
Most of the images contain family members. Maybe the algorithm could just align the image according to furniture, or align by recognize the proper face detection angle. Because most of the images are standard shots of people (although some contain images from vacations of city view, or horizons.. rarely there are art images -- in which it will be difficult identifying the proper orientation).
Copy link to clipboard
Copied
I don't know even how the current photoshop "crop and straighten" action detects the rotation.
Copy link to clipboard
Copied
I don’t see a point in continuing to participate in this discussion without meaningful data in the form of images (redacted or not).
Good luck!
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
As Photoshop doesn't have a Filter > CSI option, you will probably need to look further afield...
https://github.com/dsposito/auto-image-rotator
Copy link to clipboard
Copied
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).
Copy link to clipboard
Copied
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.