Auto image orientation…..

J
Posted By
jonzinator
May 18, 2004
Views
928
Replies
9
Status
Closed
Hello,

I often apply action to 300 or more images. Many time these action need a specific image orientation. The images often times are split on there orientation which means I have to manually rotate a few hundred images then apply my actions. Then after the actions are applied I need to rotate them back. Is there a way for PS to detect the image orientation, change it, apply a given action, and then put the images back to the original orientation if needed?

Thanks in advance for the input….Much appreciated!

Troy

Must-have mockup pack for every graphic designer 🔥🔥🔥

Easy-to-use drag-n-drop Photoshop scene creator with more than 2800 items.

MM
Mick_Murphy
May 18, 2004
Unless it is a very simple resizing action where you could use Fit Image, you need to use a script to detect the orientation of the image. If you want, I can give you a simple VB Script which would open all images in a specified folder, determine the orientation of the image and decide on whether to do Action1 or Action2 depending on the orientation.
J
jonzinator
May 18, 2004
Hi Mike,

Thanks for the quick reply. A VB script would be great! I’m driving myself crazy rotating images…..:)

my e-mail is

Thanks again…

Troy
MM
Mick_Murphy
May 18, 2004
Troy

I had one of these ready made. I have only tested it in CS by the way. I may as well post it here as my email is a bit unreliable at the moment. Just copy and paste the code below into a Notepad file and save it with a .vbs extension. Double click the file in Explorer to run the script. If you have NAV or other script blocking av software, you will need to disable script blocking or it will try to block this script because it uses the File System Object.

I haven’t got any error catching code in this but the worst that will happen is that it won’t run. Make sure you only have PS-readable image files in the source folder or you will get errors. You need to substitute the source folder path where indicated and also the names of your actions and action set. These must be exact (case sensitive and no added spaces) or you will get errors.

I suggest you record a second action to work on the vertical files. The alternative is to rotate and then re-rotate the document in the script but this makes it more complex. Include a Save As with a destination folder in each action or a simple save which will overwrite the existing file if desired. Also include a close document command in the action

‘ VBScript source code
‘opens all files in directory folderPath
‘decides on which action to perform depending on orientation of image ‘create two actions, one for horizontal and one for vertical

Dim fsoRef
Dim folderRef
Dim fileCollection
Dim fileRef
Dim appref
Dim theFolderPath

‘substitute full source folder path here
theFolderPath = "E:\TestImages2"

Set appRef = CreateObject("Photoshop.Application")

‘suppress PS dialogs
appRef.DisplayDialogs = 3

Set fsoRef = CreateObject("Scripting.FileSystemObject") Set folderRef = fsoRef.GetFolder(theFolderPath)
Set fileCollection = folderRef.Files

For Each fileRef In fileCollection

Set docRef = appRef.Open(fileRef.Path)

if docref.height > docref.width then
‘substitute name of your action and set for horizontal images appRef.DoAction "Horizontal", "ScriptSet.atn" else
‘substitute name of your action and set for horizontal images appRef.DoAction "Vertical", "ScriptSet.atn" end if

Next
LM
Lynch_Mike
May 18, 2004
Is there a way for PS to detect the image orientation, change it, apply a given action, and then put the images back to the original orientation if needed?

This might be a simpler way to do it:
If you are using windows, use windows explorer to sort by Dimension. Set the file browser to "View" your files by "Details" Next right-click on the "sort categories" at top of the file display: [Name, Filesize, Date, etc.]
You will discover a list of unused sort categories.
Now add "Dimension" and sort based on that.
Windows will separate the horizontal files from the vertical ones. This assumes they are all the same size but oriented differently, but it will also work with multiple sizes, just less elegantly. -Mike
J
jonzinator
May 18, 2004
Thanks so much guys….I’m gonna test it out right now. This has been a huge hang up for me in my workflow. Its time to get it worked out.

Thanks again…I’ll post my experience.

Troy
DR
Danny_Raphael
May 19, 2004
Mike:

What version of Windows are you using? I’m not seeing a "Dimension" category to select among the detail options in Windows 2000.

When files are sorted on their dimension characteristic, this enables you to easily select the images of a given orientation, right?

TIA…
~Danny~
J
jonzinator
May 19, 2004
Danny,

I thought the same thing but you my need to select as a folder display option. This is how I changed mine.

Right click on the header > Name < There is a popup menu. At the bottom select more. Then selset dimension. After doing this it only adds the dimension setting for that folder. Then you need to apply setting to all folders under folder options.

Another way I have figured to work the Hor. Vert. situation. In PS CS under the image explorer. Go to the folder you want to work on. Change file view to details….then sort by width or hight. Then I can easily select the vert images and batch with a given action. Then select all the Horz images and apply a differant action.

I really love the VB script idea and I want to learn more about that. Seems like a great way to get thing done in PS.

Hope that helps…..

Troy
LM
Lynch_Mike
May 20, 2004
What version of Windows are you using? I’m not seeing a "Dimension" category to select among the detail options in Windows 2000.

I am using XP. I don’t know if 2000 has the same features. I neglected to mention that the "Dimension" category was in the secondary window. (click "More…" at the bottom of the right-click list)
DR
Danny_Raphael
May 20, 2004
Troy:

Thanks for the additional info. I got to the ‘more’ button and subsequent dialog with additonal column options, but still no ‘dimension’ choice among them.

w/o being able to change it at the folder level, there’s nothing to change globally via Tools > Options dialog.

Good point on using the sort by width or height settings in the File Browser

– – – – –

Based on Lynch Mike’s add’l info (thanks, LM) the reason I’m not seeing that option must be a difference between XP and W2k. Ah, how MSFT inspires up to upgrade. 🙂

Thanks to both of you.

~Danny~

How to Improve Photoshop Performance

Learn how to optimize Photoshop for maximum speed, troubleshoot common issues, and keep your projects organized so that you can work faster than ever before!

Related Discussion Topics

Nice and short text about related topics in discussion sections