I have a thousand of pictures of the same fixed scene, but for an unknown reason some of them are vertical, not horizontal.

So I would like to batch process all the images and rotate them 90° if the width is smaller than the height of the image.

I tried to play with the "Action" and the "Batch process" feature, but I did not find where I can add conditional to my scripts.

  • 1
    I'm pretty sure this is possible. Someone else will post the answer, but I'm thinking there is a more hands-on way to do it. In a folder (in Windows but probably also on Mac) you could sort images by their dimensions, then move the vertical images to another folder, perform the rotate batching and move the files back.
    – Wolff
    Commented Feb 16, 2020 at 11:13
  • 1
    In Windows you can even just select the vertical files, right-click and rotate them directly in the folder. (I understand why you probably still want a proper answer on how to automate this in Photoshop)
    – Wolff
    Commented Feb 16, 2020 at 11:17
  • @Wolff, nice way of doing it I did not know that !
    – nowox
    Commented Feb 16, 2020 at 11:18
  • I'm unsure if using Windows to rotate images affects JPG image quality...
    – Wolff
    Commented Feb 16, 2020 at 11:19
  • 1
    @Wolff Yes, it does in some cases - AFAIR it's when height or width can't be divided by 8. Also it tends to rewrite some metadata. I can't tell exactly what, but I remember creating tool for translating "Windows-cured" metadata.
    – Krzysiu
    Commented Feb 17, 2020 at 4:25

2 Answers 2


You can put a Conditional step in an action: use the Insert Conditional... command in the Actions flyout menu:

enter image description here

So first create an action to rotate and save a document. Then create an action with a condition. There's a rule If Current Document Is Landscape

enter image description here

so Then Play Action will remain None and Else Play Action will be your rotate & save action.


Easier solution:

  • Use Bridge, which has a filter for orientation.
  • Drop the images into a folder, click the 'portrait' filter, which selects every portrait image in your folder, then the rotate tool at the top.
  • Done.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.