1 Reply Latest reply on Jul 29, 2012 3:30 PM by JJMack

    Need help in writing Action with image orientation detection script

    punggorian Level 1


      I'm using photoshop CS5, familiar with writing actions, but no knowledge of writing scripts.

      I have photo images in 2:3 aspect ration to downsize to different sizes for printing, I write action with using Fit Image script, no problem for paper size in 4x6 or 8x12, but for some paper size like 8x10 or 5x7, I have to have another two actions, one for portrait orientation images, one for landscape orientation images and have to use action manually, or by placing images into different folders before running automatic actions.

      How do I create scripts that allow me to change the height or width of canvas size base on the image orientation. eg for 5R paper size, change image height to 2100 pixel for portrait orientation, change image width to 2100 pixel for landscape orientation? So it will save time and less error.

      Thank you.

        • 1. Re: Need help in writing Action with image orientation detection script
          JJMack Most Valuable Participant

          It easy in a script to tell Oritation


          if (activeDocument.height > activeDocument.width) [....]; //Portrait

          else [...]; //landscape or square



          You use Fit Image since CS3 Fit images is a script but its a complex one for it written as a Plug-in that records setting into actions steps when recorded in an action.  However it not that hard to read the resize section of that script. Photoshop prior to CS6 and after PS7 also shipped with Scripting Documentation and sample scripts to learn from. Look for a Scripting folder