Photoshop UXP Plugin — Images Place on Frames but Not Fitting Correctly (Clipping Mask + Transform Issue)

Hi everyone,

I’m building a Photoshop UXP plugin using React that automatically places selected photos into selected PSD frame layers.

Here’s what’s happening right now:

- When I select 1 or more frame layers and then select photos,

- The plugin places the images on top of the selected frames (so layer targeting works),

- But they aren’t fitting inside the frame bounds properly — they appear too large or off-center.

I think the clipping mask and transform logic is not being applied correctly after placement.

Here’s what I want:

Each selected photo should fit exactly inside the corresponding frame’s bounding box — similar to how “Place Embedded” with “Clipping Mask” behaves manually.

I’m using batchPlay for placement and transformation.

Can anyone share a working snippet or correct sequence for: create smart object → transform → set clipping mask?

Or can anyone guide me how to fix this?

Thanks in advance!

— Vijay