Copy link to clipboard
Copied
Hello guys, I am trying to make an script where I can change the size of the current layer
but it is an smart object, is that possible?
I've resolved my problem with the next code:
offsetX = 200 - app.activeDocument.activeLayer.bounds[0].as("px");
offsetY = 500 - app.activeDocument.activeLayer.bounds[1].as("px");
app.activeDocument.activeLayer.translate(offsetX, offsetY);
200 and 500 are the coordinates set in pixels in my case.
Copy link to clipboard
Copied
One can transform (scale, rotate, …) a Smart Object via Script so what is giving you problems?
Copy link to clipboard
Copied
I've resolved my problem with the next code:
offsetX = 200 - app.activeDocument.activeLayer.bounds[0].as("px");
offsetY = 500 - app.activeDocument.activeLayer.bounds[1].as("px");
app.activeDocument.activeLayer.translate(offsetX, offsetY);
200 and 500 are the coordinates set in pixels in my case.