2 Replies Latest reply on Mar 30, 2017 7:24 AM by joshv44748569

    Need Script Help for Batch Photo Editing


      I have about 1000 folders, with one or two PSD's in each. Each PSD has the cutout product photography from different angles, but they are sitting on top of each other so I didn't have to save multiple PSD's for each picture. I now need to resize each picture(layer) to be 3000x3000px at 72dpi. This would take me about 2 weeks if I was to do each one individually.


      Parent Folder (example)

      • Child Folder-SKU1
        • PSD file (4 layers plus background color layer)
        • PSD file (1 layer with no background layer)
      • Child Folder-SKU2
        • PSD file (3 layers with no background layer)
        • PSD file (1 layer with 1 background layer)


      Goal – Run batch of Parent folder and it would open each PSD, move each layer to a new document, crop to square, resize to 3000x3000 and save the .JPG to the accompanying Child Folder ideally with the original name of the childfolder-SKU_#1.jpg


      I created two Actions to do this.

      1. Duplicates layer to new document, return to previous document, delete layer, repeat.
        1. This moves each layer to an open document, but this is not reliable when each document has a different amount of layers.
        2. I believe a script would need to count layers, and repeat the count for the action.
        3. This also moves over the background solid color layer, if it was possible to recognize and delete a solid color layer, it would save us a lot of time later on by not having to go through the folder and delete pictures with nothing on them.
        4. This action expands the canvas, trims to size, reduces the layer size to 90%, resizes the image to 3000x3000 and exports for Save to Web.
          1. I expand the canvas to 20x20inches because some of the layers are sitting on the edge of the document and when I trim it cuts off some of the product.
          2. Trim to Size to get rid of excess white space
          3. I reduce the layer size to 90%, this creates a nice white space border around the product.
          4. I reduce image to 72dpi and change widest side to 3000px, then resize canvas to be 3000x3000px.
            1. This creates an issue for products that are vertical; so I have a script that rotates vertical products to horizontal, then crops the width to 3000. (This leaves the image sideways, so we will have to go back and rotate all the sideways shots)(Unless there is a way to recognize it did rotate, and at the very end it rotates back)
        5. Export Save for Web
          1. Issue comes up that all the files are saved to the “last folder saved to”. This is problematic when all the filenames aren’t unique. So it overwrites each file with the new ones.
          2. This is where it would be nice to save the image back to the child folder, and rename it if possible with the child folder name. Either way I still have to go back through these folders and rename the .jpg’s with the new naming system.
        • 1. Re: Need Script Help for Batch Photo Editing
          JJMack Most Valuable Participant

          I cringe when I read appends like your.  Actions can not use logic  so the can not determine how many file are in a folder and can nor find out how many layer are in a psd document.  Action also  have a very hard time saving multiple different named files for a document it is processing.  When I see 3000x3000px @ 72DIP it make no sense for you do not Print a 3000x3000px image 72DPI,  41.6" x 41.6" low resolution for what.  Also 3000px x 3000px will not even fit on a 4k  3860px x 2160px Display.


          You need to script you whole process  and for best image quality do not interpolate an image more than once.  Think more about what you want to do. Then  design a process that will work.  Cutouts have transparency. Object from different angles will result in layer with diffener bound aspect ratios and the object may not be center over the document canvas.  You need to deride what kine of output image you need. What the images composition will be the you produce..


          you may want to start with the Image Processor script or  the better download Image Processor Pro script to process your Images tree.  To process all your image folders.

          • 2. Re: Need Script Help for Batch Photo Editing
            joshv44748569 Level 1

            Thank you JJ for the reply. The image sizes are what our website design company are requesting. I agree the sizes are oversized, but they are being ran through a compression software before being uploaded; plus the images are being used at full size for the magnify glass effect when viewing the product.