hello
i am doing same thing , i tried both of your codes, but in my case i am using exactly same image as layer holder,
when i manually do this in photoshop it works fine(i dont have to do any placement because it is exactly as same pixel as layer), but when i do it through the code, the photo becomes more wider than i thought
code i used --
with Session(mockup, action="open",auto_close=True) as ps:
active_layer = ps.active_document.activeLayer
bounds = active_layer.bounds
# in this segment we are getting the frame of mockup, then we use
# our function to adjust the image within given pixel without distortion
width = int(bounds[2] - bounds[0])
height = int(bounds[3] - bounds[1])
adjust_image()# i replace my image here with same width and height as layer
replace_contents = ps.app.stringIDToTypeID("placedLayerReplaceContents")
desc = ps.ActionDescriptor
idnull = ps.app.charIDToTypeID("null")
desc.putPath(idnull, 'img.png')
ps.app.executeAction(replace_contents, desc)
ps.active_document.saveAs(f'res.jpg', ps.JPEGSaveOptions())
i am attaching results for reference -
using code -
manually -
mockup file i used - link
hello i am doing same thing , i tried both of your codes, but in my case i am using exactly same image as layer holder,
when i manually do this in photoshop it works fine(i dont have to do any placement because it is exactly as same pixel as layer), but when i do it through the code, the photo becomes more wider than i thought
code i used --
i am attaching results for reference - using code -
manually -
mockup file i used - link
Originally posted by @chetan-SMRI in https://github.com/loonghao/photoshop-python-api/issues/38#issuecomment-1507944155