This script converts the active layer into a smart object:
createSmartObject(app.activeDocument.activeLayer);
function createSmartObject(layer)
{
var idnewPlacedLayer = stringIDToTypeID( 'newPlacedLayer' );
executeAction(idnewPlacedLayer, undefined, DialogModes.NO);
}
My question: Is there a shorter way to code this?
A Smart Object is a Photoshop layer that contains all the same image information of a normal layer but a Smart Object layer will allow you to perform non-destructive edits. For example, you can resize the image as often as you want without causing any degradation. I demonstrate this later in the article.
createSmartObject();
function createSmartObject() {
var idnewPlacedLayer = stringIDToTypeID( 'newPlacedLayer' );
executeAction(idnewPlacedLayer, undefined, DialogModes.NO);
}
You don't need to pass the layer into the function--it acts upon whatever the current active layer happens to be.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With