Script to import, warp, resize and move layers
Hey, all the generous and bright minds out there 🤩
I would like help reducing the time it takes to make a collage of multiple photos of wooden boxes. In the past months, I had amazing help from c.pfaffenbichler and Stephen_A_Marsh regarding this process.
c.pfaffenbichler created a script to skew smart objects that worked most of the time - See post HERE. However, a bug created stretched images very inconsistently. I read online this happened to others using actions and Smart Objects. Besides this my "input files" changed, instead of jpgs, I am now dealing with PSD files with a layer mask created by Remove.bg.
I would like to have the layer mask of transparency in my input files directly editable in my template file. It made me decide to abandon the desire to keep the original photo information and quality. Unfortunately, this also means the powerhouse of a script he created for me can't do the job anymore. 🥺
I would like to ask again for help 🙏
Process steps
- Start ingredients:
- Template file (Framefoto-template NEW v2.psd)
- Multiple PSD files containing 2 layers, where 1 is a layer of the photo with a layer mask (box 1.psd, box 2.psd, box 5.psd) - 1st step script desired - fetch and copy layers with mask:
- Pop-up to multi-select PSD files of the boxes
- Script to look for layers with a mask (if needed, currently always is 1 named remove.bg)
- Layer, including the mask, copied to the active document (Template file) into the layerset "FOTOS"
- Layer name renamed to the original file (if this is even possible)
- IF layer > then canvas height/width resize to fit
- Center on canvas
- 2nd step script desired - transform per photo:
- manually 4 points will be assigned by the user
- based on the 4 points, skew/perspective warp to make corners 90˚
- based on the 4 points area, Resize image + mask to make the area 800x800 pixels
- based on the 4 points area, Move the layer to static coordinates
Folder containing all example files
Potential useful Information
The information below was recorded during the perspective warp action. I replaced the parts that should be based on the manual assigned 4 points by the user.
Action:
Perspective Warp current layer
Mode: Warp
Reference Bounds: rectangle
Top: [VARIABLE INPUT] pixels
Left: [VARIABLE INPUT] pixels
Bottom: [VARIABLE INPUT] pixels
Right: [VARIABLE INPUT] pixels
Vertices: point list
point: [VARIABLE INPUT] pixels, [VARIABLE INPUT] pixels
point: [VARIABLE INPUT] pixels, [VARIABLE INPUT] pixels
point: [VARIABLE INPUT] pixels, [VARIABLE INPUT] pixels
point: [VARIABLE INPUT] pixels, [VARIABLE INPUT] pixels
Warped Vertices: point list
point: 2500 pixels, 1740 pixels
point: 2900 pixels, 1740 pixels
point: 2900 pixels, 2140 pixels
point: 2500 pixels, 2140 pixels
Quads: Quad list
Quad
Vertex Indices: 0, 1, 2, 3
