1 Reply Latest reply on Feb 22, 2012 1:11 PM by JJMack

    create a rectangle shape using rectangle tool according to photo sizes

    S M Apoorva Level 1

      Dear Sir


      My Name is Sathya Murthy


      I am Newbie to scripting. I have a large number of images coming daily some are horizontal in shape

      ie width is more than its height and some are vertical ie height is more than its width.

      The sizes of the images are different from each other.

      They are not in same sizes.


      I want a script


      1. Which creates a new photoshop document of any required page size i want

      2. Ask to show the folder where photos or images are there.

      3. if the photos are horizontal in shape (ie width is more than its height) it should

          create a shape using a rectange shape tool.

           the shape size must be 6 X 4 (ie 6 inch width & 4 inch height)

      4. If the photos are vertical in shape (ie height is more than its width) it should

          create a shape using a rectange shape tool.

          the shape size must be 4.5 X 7  (ie 4.5 inch width & 7 Inch height)

      5. Each shape should be rasterized and saved in a separate layer of new photoshop

          document created (point No.1)


      Important Note: Don't resize photos or images i want only shapes which is saved in layers

                              This shapes i later use in photo collage tool kit for creating photo albums



      I can manually create those shapes for them but it takes lot of time and photos should be arranged in order

      where some are horizontal and some are vertical.


      I hope you understand what i want

      please help me in this regard.


      thanks in advance

      Sathya Murthy

        • 1. Re: create a rectangle shape using rectangle tool according to photo sizes
          JJMack Most Valuable Participant

          Sathya If you look in your Adobe Photoshop tree you will find a folder "Scripting" it contains three subfolders "Documents", "Sample Scripts" and "Utilities". In "Documents" there is the "Photoshop CS5 Scripting Guide.pdf" and thers ate three PDF with information for the three scripting lanuges supported.  The the folder "Sample Scripts" there are three more subfolders "AppleScript", "JavaScript"  and "VBScript" in these folders are exapmle script to learn from.. JavaScript is supported on PC and Mac where AppleScript works only on Mac and VBScript only on PC. In the  "Utilities". is the ScriptListener Photoshop every thing that Photoshop can record witn be recorded into two logs on you desktop then this plug-in is installed. One Log in JavaScript cone and the other log in VBScript.  Some thing can not be scripted using the Adobe Photoshop Document Object Model.  Code in these log can be use to add function using the action manager in scripts.


          The Adobe ExtendScript Toolkit CS5 is also installed on you system the is a provides a GUI for developing the Scripts you need it an editor debugger and viewer. You have some learning to do if you need to create scripts.


          Also in my Crafting Actions Package I included some scripts to be used within actions.  Actions are easy to record and Edit on their own actions can not use logoc. However actions can use scripts so simple utility scripts can be written for use within action to add logic and function to Actions.   One of the Scripts is a Plugin based on Adobe Fit image Plugin.  Like Fit Image  my AspectRatioSelection plug-in script like fit image will make rectangal or oval aspect ratio selectino using the documents current orintation lanscape or portrait.  It would be very easy to create an Action to do what you want.  For a document be it layer or flat.  The action would simplely add a new empty layer move it the the front of the layer stak (Top Layer) stamp visible layers into the new top layer then use the AspectRatioSelection plugin to make a recorded aspect ratio selection or an interactive Aspect Selection by turning on the steps dialog. The action would then invert this selection and clear the selection thus cropping the layer to the desired aspect ratio.

          Crafting Actions Package Contains

          • Action Actions Palette Tips.txt
          • Action Creation Guidelines.txt
          • Action Dealing with Image Size.txt
          • Action Enhanced via Scripted Photoshop Functions.txt
          • CraftedActions.atn Sample Action set includes an example Watermarking action
          • Sample Actions.txt Photoshop CraftedActions set saved as a text file.
          • 12 Scripts for actions




          By the way were you able to turn on the thumbnail view when selecting images for collages while using the interactive script in my Photo Collage Toolkit.... You do not need to do any croping or resizing of images for the  Toolkit it will fit any image file to the Collage area being populated.   For best results Image should have the same orintation as the area being populated.  If you populate templates interactivly  when your selecting an image files you can turn on the thumbnail view in the selection dialog and select an image with matching orintation for the highlited area being populated.   Once you select a file the scripts will place the image file in resize the image to fit the location and center it over the location being populated.   In the Interactive script you are then given an oportunity to teak the positioning and sizing  of the image you can transform the image composition angle size.etc Nothing  has been croped only masked. There is a tutorial and a video in the help.  Please view the video here or use the help button when using the scripts look for these tutorials.




          Please let me know that you have seen and read my appends.  You seem the be having a problem understaning my documentation and appends I'm at my wits end.  You would not be having a problem if you understood what I've written....