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.
- Duplicates layer to new document, return to previous document, delete layer, repeat.
- This moves each layer to an open document, but this is not reliable when each document has a different amount of layers.
- I believe a script would need to count layers, and repeat the count for the action.
- 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.
- 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.
- 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.
- Trim to Size to get rid of excess white space
- I reduce the layer size to 90%, this creates a nice white space border around the product.
- I reduce image to 72dpi and change widest side to 3000px, then resize canvas to be 3000x3000px.
- 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)
- Export Save for Web
- 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.
- 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.
