Copy link to clipboard
Copied
Hello all scripters,
Two layers define a clipping mask:
This is a rectangular dynamic form and a High Res smart Object.
Now, in a script, I have to detect that these two layers form the clipping mask.
By now, I see no property that I could use: Document.layerSets and Document.layerComps are empty, and Layers' properties don't indicate these two layers are related.
Any Idea?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thank you, I didn't see in the JS CC Ref 2019 guide that this property 'grouped' is related to a clipping mask 🙂
Is this property related to other grouping technique or just the clipping mask?
Thank you, this will help me to automate a complex workflow with resizing.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Can you please provide an example selects the two layers, groups them, and the applies the clipping mask to the top layer.
Thank you.
Copy link to clipboard
Copied
I figured it out... Here is a Python snippet I used to create a collage that would grab images from a folder and import them into one document on a new layer. In between each layer I created a new layer with a black square box that I want to clip the image into. The createPlaceHoderBlock() method simply produces a new layer and places a square block in docRef
width=12
height=8
docRef = app.Documents.Add(width, height, 300)
image_files = glob.glob(source_path + '/' + '*.jpg')
for fileName in image_files:
createPlaceHolderBlock()
srcdoc=app.Open(fileName)
srcdoc.resizeImage(newWidth,newHeight,Resolution)
srcdoc.Close() # close new image
NewLayerRef = srcdoc.ArtLayers[0].Duplicate(docRef) # copy new image into docRef
NewLayerRef.translate(newx_inches,newy_inches) # This will translate to placeholder location
# All that is needed to apply the clipping mask to the layer below is the use
NewLayerRef.grouped=True.
NewLayerRef.grouped=True
Here's a screenshot:
Copy link to clipboard
Copied
I created a simple Collage template for placing in Images. Because there are no smart Object Images layers in the templates. Placed in images can not be rotated and Warped by existing placed in image smart objects layer image place holders by the smart object layer's object transform. For a collage template all the use required is a Photoshop Background layer in the template and Image Alpha channel to map up the 53 Images ins a collage. These Alpha channels map the images Location, Size and Shape. Image are placed in in file name sort order. Image 1 is placed in above the Background layer and scaled to fill the bounds of Image 1 Alpha channel selection and positioned centered to the bounds the masked to the Selections shape. This is repeated for the other images. each is placed in above the previous place in image. The Script can add Text File name stamps over the Image location. These stamp are added as the top layer above all other later in the document when each image has been placed in sized positioned and mask. The collage scripts can also are Layer styles the Placed in images and text stamps. I wanted Collage templates to be easy to create and populate.
Free Photoshop Photo Collage and Mockup Toolkit
Copy link to clipboard
Copied
Hi sir, I have recently started working on the same project but I don't know JavaScript I know the python I have used
Win32com.client for some automation but I am not able to insert images in the layer which I want. If you provide your code it will be helpful for me
Copy link to clipboard
Copied
Hi sir, I have recently started working on the same project but I don't know JavaScript I know the python I have used
Win32com.client for some automation but I am not able to insert images in the layer which I want. If you provide your code it will be helpful for me
By @vilas_4
Sadly, JJMack is no longer with us.
You can find his scripts here:
Copy link to clipboard
Copied