Skip to main content
marckoeschinger
Participant
March 16, 2024
Question

smartobjekts from raw to ps multi layer

  • March 16, 2024
  • 3 replies
  • 143 views

hello community,

Is there a function that allows you to load images from the bridge into Photoshop as a stack so that all loaded layers/images are smart objects... so that each layer leads back to the RAW? Is there a way to enable this function in Adobe. This may come with an update

Thanks and regards

This topic has been closed for replies.

3 replies

D Fosse
Community Expert
Community Expert
March 17, 2024

Yes, it needs to be clear that the Lightroom option also creates embedded smart objects, not linked smart objects. So any changes have to be made by opening the smart object layer, there is no connection to the original raw file.

Stephen Marsh
Community Expert
Community Expert
March 17, 2024

I wrote a script for this, the requirement is that you only have the documents open that you wish to combine/stack.

 

Note: opening a raw file as an object creates a copy of the original raw file that is embedded as a raw image smart object, it isn't linked back to the original raw file. So if you make changes to the original raw file, the embedded copy doesn't reflect those changes as it only has the develop settings from when the file was originally opened as an object.

 

So open two or more raw files as smart objects in Photoshop, then run this script:

 

/*
Stack Open Smart Object Documents.jsx
Version 1.0 - January 4th 2020, Stephen Marsh
*/

#target photoshop

if (app.documents.length > 1) {

  var baseDoc = app.activeDocument;
  var baseName = app.activeDocument.name.replace(/\.[^\.]+$/, ''); // Base Doc Name RegEx
  app.activeDocument.activeLayer.name = baseName;
  baseDoc.duplicate('SO Stack');
  baseDoc.close(SaveOptions.DONOTSAVECHANGES);

  // Duplicate single SO layer to SO Stack doc
  for (var i = 0; i < app.documents.length; i++) {
    app.activeDocument = app.documents[i];
    displayDialogs = DialogModes.NO;

    var docName = app.activeDocument.name.replace(/\.[^\.]+$/, ''); // Source Doc Name RegEx
    duplicate(docName, 5); // Source Doc for Duplicate Layer Rename
    function duplicate(name2, version) {
      var c2t = function (s) {
        return app.charIDToTypeID(s);
      };
      var s2t = function (s) {
        return app.stringIDToTypeID(s);
      };
      var descriptor = new ActionDescriptor();
      var list = new ActionList();
      var reference = new ActionReference();
      var reference2 = new ActionReference();
      reference.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
      descriptor.putReference(c2t("null"), reference);
      reference2.putName(s2t("document"), "SO Stack"); // Target Doc for Duplicate Layer
      descriptor.putReference(s2t("to"), reference2);
      descriptor.putString(s2t("name"), name2);
      descriptor.putInteger(s2t("version"), version);
      list.putInteger(3);
      descriptor.putList(s2t("ID"), list);
      executeAction(s2t("duplicate"), descriptor, DialogModes.NO);
    }

  };

  // Remove the extra layer (yes this is hack to work round the poor coding :)
  app.activeDocument.layers[0].remove();

  // Close all open files that are not named 'SO Stack'
  var docs = app.documents;
  for (var i = docs.length - 1; i >= 0; i--) {
    if (docs[i].name.indexOf('SO Stack') < 0) {
      docs[i].close(SaveOptions.DONOTSAVECHANGES);
    }
  }

  // Sort the resulting layer stack alphabetically
  // gist.github.com/vladocar/1628874
  var layers = activeDocument.layers;
  var layersArray = [];
  var len = layers.length;
  // store all layers in an array
  for (var i = 0; i < len; i++) {
    layersArray.push(layers[i]);
  }
  // sort layer top to bottom
  layersArray.sort();
  for (i = 0; i < len; i++) {
    layersArray[i].move(layers[i], ElementPlacement.PLACEBEFORE);
  }

  // Deselect All Layers  
  app.runMenuItem(stringIDToTypeID('selectNoLayers'));

  // Reveal All Canvas Expansion
  executeAction( stringIDToTypeID( "revealAll" ), new ActionDescriptor(), DialogModes.NO );
} 

else {
  alert('2 or more smart object layer images should be open before running this script!');
}

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

D Fosse
Community Expert
Community Expert
March 16, 2024

Not from Bridge, but you can do it from Lightroom: