Photoshop: Load multiple layers into separate smart objects

  • 1
  • Idea
  • Updated 10 months ago
  • (Edited)
It would be useful to be able to load multiple images into separate smart layers in a single step.  Seems like there could be an option on the Load Files into Stack script, or when dragging from a file list, to create a smart object for each layer.   I realize this likely has been suggested before, but I'll add my voice to the chorus.  Thanks.
Photo of Zolt Levay

Zolt Levay

  • 1 Post
  • 0 Reply Likes

Posted 2 years ago

  • 1
Photo of Max Johnson

Max Johnson, Champion

  • 450 Posts
  • 208 Reply Likes
Cannibalized a bit of code from this post and added a few lines...
http://stackoverflow.com/questions/27...

save the script below as something like convertEachLayerToSmartObject.jsx and run it. Should convert all your selected layers to smart objects individually, rather than as a big group.

//-------------------------------------------------------------------------
function convertEachLayerToSmartObject(){
var resultLayers=new Array();
try{
var idGrp = stringIDToTypeID( "groupLayersEvent" );
var descGrp = new ActionDescriptor();
var refGrp = new ActionReference();
refGrp.putEnumerated(charIDToTypeID( "Lyr " ),charIDToTypeID( "Ordn" ),charIDToTypeID( "Trgt" ));
descGrp.putReference(charIDToTypeID( "null" ), refGrp );
executeAction( idGrp, descGrp, DialogModes.NO );
for (var ix=0;ix< llen; l++ ) {
app.activeDocument.activeLayer = resultLayers[l]
executeAction(stringIDToTypeID('newPlacedLayer'), undefined, DialogModes.NO);
}
return resultLayers;
}

convertEachLayerToSmartObject();
Photo of Jaroslav Bereza

Jaroslav Bereza

  • 781 Posts
  • 166 Reply Likes
Can this settings solve your request? http://sklad.bereza.cz/00-jarda/00_screenshot/2016-09-02_212126.jpg

If you drag images from Windows folder into document canvas, then each image is separate smart object layer. It works for me.
Photo of Colin Cheer

Colin Cheer

  • 1 Post
  • 0 Reply Likes
When I try that script I get "Error 15: Try without catch or finally. Line:18". I am running PS 2017.1.1 on windows 10. This one works though: https://elevatedigitalcommerce.com/blog/photoshop-scripts-and-extensions-to-improve-your-workflow
(Edited)