1

I have multiple images using the same linked smart object, but I need to make changes to some individual images and want to link it to a new linked smart object. At the moment if I change one out, it changes out all linked smart objects that had the same name. Is there a way to duplicate a linked smart object as a new smart object so I can swap it out without effect other linked smart objects with the same name?

Thanks in advance!

  • It has to be scripted – Joonas Apr 22 '15 at 5:47
  • I don't even remember writing that comment, but Joonas from the past is partially right. You can do this without scripting, but "one click solution" could be achieved with scripting. The script in this answer is pretty close and wouldn't take too much effort to modify. --- Manually you can do this: 1. Select the linked SO and duplicate it to a new document. 2. Replace the contents like you normally would. 3. Duplicate it back to the original document. 4. Delete the original layer if you want that. – Joonas Apr 22 '15 at 11:10
3

In the Layers palette, click the right mouse button on the Smart Object and from the context menu choose "New Smart Object Via Copy".

New Smart Object Via Copy

  • Sorry maybe I wasn't clear enough. I am not using Smart Objects. I am using Linked Smart Objects which does not have that option. – Choc Apr 22 '15 at 2:51
2

Decided to expand my comment into an answer.


You can do that manually:

  1. Select the linked SO and duplicate it to a new document.
  2. Replace the contents like you normally would.
  3. Duplicate it back to the original document.
  4. Delete the original layer if you want that

You can almost make this as Action, but off the top of my head, I couldn't figure out how to record action when you select first layer. Because you can't replace contents when you have multiple layers selected.

OR you can do it with scripting / use this script

It was a pretty simple modification that had to be done to the code in the answer I mentioned in my comment, so I figured, why not.

You can find the script here or at the bottom of the answer.

When you run the code, there will be dialog that asks you to choose the replacing content, after which it continues to move the duplicated smart object(s) back to your original document.

// https://gist.github.com/joonaspaakko/ace1ec3455b6959dc611

#target photoshop

// If there are any documents open, run the code...
// =================================================
if ( app.documents.length > 0 ) {

    // Used later on when the layers are duplicated back to the original document.
    // ===========================================================================
    var docName = app.activeDocument.name;

    // Script listener code - Duplicate active group to a new document.
    // =================================================================
    var idMk = charIDToTypeID( "Mk  " );
        var desc14 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref10 = new ActionReference();
            var idDcmn = charIDToTypeID( "Dcmn" );
            ref10.putClass( idDcmn );
        desc14.putReference( idnull, ref10 );
        var idUsng = charIDToTypeID( "Usng" );
            var ref11 = new ActionReference();
            var idLyr = charIDToTypeID( "Lyr " );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idTrgt = charIDToTypeID( "Trgt" );
            ref11.putEnumerated( idLyr, idOrdn, idTrgt );
        desc14.putReference( idUsng, ref11 );
        var idVrsn = charIDToTypeID( "Vrsn" );
        desc14.putInteger( idVrsn, 5 );
    executeAction( idMk, desc14, DialogModes.NO );     

    // Script listener code - Select first layer ( not counting Background layer).
    // Just in case more than one layer was selected.
    // ===========================================================================
    var idslct = charIDToTypeID( "slct" );
        var desc76 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref33 = new ActionReference();
            var idLyr = charIDToTypeID( "Lyr " );
            ref33.putName( idLyr, app.activeDocument.layers[0].name );
        desc76.putReference( idnull, ref33 );
        var idMkVs = charIDToTypeID( "MkVs" );
        desc76.putBoolean( idMkVs, false );
    executeAction( idslct, desc76, DialogModes.NO );

    // Script listener code - Replace contents.
    // =====================================================================
    var idplacedLayerReplaceContents = stringIDToTypeID( "placedLayerReplaceContents" );
        var desc8 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
        desc8.putPath( idnull, new File( "~" ) );
    executeAction( idplacedLayerReplaceContents, desc8, DialogModes.ALL );

    // Script listener code - Select all layers again
    // =======================================================
    var idselectAllLayers = stringIDToTypeID( "selectAllLayers" );
        var desc125 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref59 = new ActionReference();
            var idLyr = charIDToTypeID( "Lyr " );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idTrgt = charIDToTypeID( "Trgt" );
            ref59.putEnumerated( idLyr, idOrdn, idTrgt );
        desc125.putReference( idnull, ref59 );
    executeAction( idselectAllLayers, desc125, DialogModes.NO );

    // Script listener code - Duplicate active group to the prior document.
    // =====================================================================
    var idDplc = charIDToTypeID( "Dplc" );
        var desc16 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref13 = new ActionReference();
            var idLyr = charIDToTypeID( "Lyr " );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idTrgt = charIDToTypeID( "Trgt" );
            ref13.putEnumerated( idLyr, idOrdn, idTrgt );
        desc16.putReference( idnull, ref13 );
        var idT = charIDToTypeID( "T   " );
            var ref14 = new ActionReference();
            var idDcmn = charIDToTypeID( "Dcmn" );
            ref14.putName( idDcmn, docName );
        desc16.putReference( idT, ref14 );
        var idVrsn = charIDToTypeID( "Vrsn" );
        desc16.putInteger( idVrsn, 5 );
    executeAction( idDplc, desc16, DialogModes.NO );

    // Closes the new document.
    // =======================================================
    app.activeDocument.close( SaveOptions.DONOTSAVECHANGES );

}
  • Forgot to mention. Just as a heads up: The script duplicates the Smart Object(s), but it doesn't duplicate the actual file(s). Personally I would just duplicate the file inside the dialog by right clicking, if that I what I wanted to happen. Also, the script doesn't navigate to the path of the original file. – Joonas Apr 22 '15 at 15:29
0
  1. Double click on your linked smart object in the layers panel.
  2. Save as, with a new name. make changes, save & close.
  3. Right click linked smart object in layers panel > convert to smart object.
  4. Right click again and relink to file, choose the new file you just saved.
-1

Right click on the new layer > Convert to Smart Object. Click into that layer and replace object. Save and you should have converted that layer without messing with the original layer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.