Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Converting a bunch of artboards into separate Linked Smart Objects

Community Beginner ,
Sep 18, 2025 Sep 18, 2025

Hello all, 

I'm currently working on a huge file with numerous artboards. To lighten the file I'm converting each artboards into a smart object, into a linked smart object.

Since it's taking me some time to actually do it manually, I'm looking for a way to it automatedly create *linked smart objects* out of a selection. 

I'm on photoshop 2025 if that helps. 

 

Thanks for any help or clue 🙂

Arnault

TOPICS
Actions and scripting , Windows
390
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Sep 18, 2025 Sep 18, 2025

@arnault_6305 

 

Try this v1.0 code. Revisions can be made if needed.

 

EDIT: 22nd September, code updated to v1.2!

 

Note: The linked smart object will have four guides indicating the original artboard bounds, which might be useful if you have content extending beyond the artboard edges.

 

/* 
Convert All Artboards Content to Separate Linked Smart Objects.jsx
Stephen Marsh
v1.0 - 19th September 2025: Initial release
v1.1 - 20th September 2025: Corrected the layer selection code to include gro
...
Translate
Community Expert , Sep 19, 2025 Sep 19, 2025

@arnault_6305 

 

Rather than processing all artboards, this new script only works on (multiple) selected artboards.

 

EDIT: 22nd September, code updated to v1.2!

 

/* 
Convert Selected Artboards Content to Separate Linked Smart Objects.jsx
Stephen Marsh
v1.0 - 19th September 2025: Revised to work on selected artboards instead of all top-level layerSets
v1.1 - 20th September 2025: Corrected the layer selection code to include groups
v1.2 - 22nd September 2025: Added a progress bar for the artboar
...
Translate
Adobe
Community Expert ,
Sep 18, 2025 Sep 18, 2025

I have two separate scripts that could be combined to do this. I'll look at it later when I have time.

 

So to be clear, each artboard should be retained, but the content of the artboard should be a single linked smart object.

 

Where should the linked .psb file be saved? The same folder as the main document? In a new sub folder?

 

One of the scripts:

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/converting-to-linked-smart-object/m-p...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 18, 2025 Sep 18, 2025

Hey, thank you so much.

Yes, each artboard should become a separate linked smart object. The idea is to extract the content of each artboard into its own .psb file, and then replace the artboard content in the main file with a linked smart object pointing to that .psb.

I’d like all the .psb files to be saved in a dedicated subfolder next to the main document. 

Appreciate any help if you get around to combining your scripts.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 18, 2025 Sep 18, 2025
quote

Hey, thank you so much.

Yes, each artboard should become a separate linked smart object. The idea is to extract the content of each artboard into its own .psb file, and then replace the artboard content in the main file with a linked smart object pointing to that .psb.

I’d like all the .psb files to be saved in a dedicated subfolder next to the main document. 

Appreciate any help if you get around to combining your scripts.


By @arnault_6305

 

That's doable, I have a rough version in progress, I should have something for you tomorrow.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 18, 2025 Sep 18, 2025

Oh my god! You're really a lifesaver!

I'm really looking forward to trying it.

Let me know if you need any extra details on anything regarding the .psb files.

 

Thanks a lot 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 18, 2025 Sep 18, 2025

@arnault_6305 

 

Try this v1.0 code. Revisions can be made if needed.

 

EDIT: 22nd September, code updated to v1.2!

 

Note: The linked smart object will have four guides indicating the original artboard bounds, which might be useful if you have content extending beyond the artboard edges.

 

/* 
Convert All Artboards Content to Separate Linked Smart Objects.jsx
Stephen Marsh
v1.0 - 19th September 2025: Initial release
v1.1 - 20th September 2025: Corrected the layer selection code to include groups
v1.2 - 22nd September 2025: Added a progress bar for the artboard and .psb file processing loops
https://community.adobe.com/t5/photoshop-ecosystem-discussions/converting-a-bunch-of-artboards-into-separate-linked-smart-objects/m-p/15510949
Partly based on:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/converting-to-linked-smart-object/m-p/13357539
Note: The linked smart object will have four guides indicating the original artboard bounds, which might be useful if you have content extending beyond the artboard edges.
*/

#target photoshop

app.activeDocument.suspendHistory("Convert All Artboard's Content to Separate Linked Smart Objects", "main()");

function main() {
    if (app.documents.length > 0) {
        var doc = app.activeDocument;
        var docName = doc.name.replace(/\.[^\.]+$/, '');
        var layerSets = doc.layerSets;

        // 1st Progress Bar: Artboards
        var win1 = new Window("palette", "Processing Artboards", undefined, { closeButton: false });
        win1.orientation = "column";
        win1.alignChildren = ["fill", "top"];
        win1.margins = 15;

        var txt1 = win1.add("statictext", undefined, "Processing artboards...");
        txt1.alignment = "fill";

        var progressBar1 = win1.add("progressbar", undefined, 0, layerSets.length);
        progressBar1.preferredSize = [300, 20];

        win1.show();

        var processedCount = 0;

        for (var i = 0; i < layerSets.length; i++) {
            var group = layerSets[i];

            txt1.text = "Artboard " + (i + 1) + " of " + layerSets.length + " - " + group.name;
            progressBar1.value = i;
            win1.update();

            artboardBounds(group, doc);
            deselectAllLayers();

            var selectedCount = selectAllLayersInGroup(group);

            if (selectedCount > 0) {
                var newSOName = docName + "_" + group.name;
                convertToEmbeddedSmartObject(newSOName);
                convertToLinkedSmartObject();
                processedCount++;
            } else {
                alert("No layers found in group: " + group.name);
            }

            progressBar1.value = i + 1;
            win1.update();
        }

        win1.close();

        // 2nd Progress Bar: PSB files
        var psbFiles = getPSBFiles(doc);
        if (psbFiles.length > 0) {
            var win2 = new Window("palette", "Processing PSB Files", undefined, { closeButton: false });
            win2.orientation = "column";
            win2.alignChildren = ["fill", "top"];
            win2.margins = 15;

            var txt2 = win2.add("statictext", undefined, "Processing PSB files...");
            txt2.alignment = "fill";

            var progressBar2 = win2.add("progressbar", undefined, 0, psbFiles.length);
            progressBar2.preferredSize = [300, 20];

            win2.show();

            for (var i = 0; i < psbFiles.length; i++) {
                txt2.text = "File " + (i + 1) + " of " + psbFiles.length + " - " + decodeURI(psbFiles[i].name);
                progressBar2.value = i;
                win2.update();

                processSinglePSB(psbFiles[i]);

                progressBar2.value = i + 1;
                win2.update();
            }

            win2.close();
        }

        app.beep();
        alert(processedCount + " artboards" + (processedCount === 1 ? "" : "s") + " processed to linked smart objects.");


    } else {
        alert("A document must be open to use this script!");
    }
}


///// Helper Functions /////

function getPSBFiles(doc) {
    try {
        var docName = doc.name.replace(/\.[^\.]+$/, '');
        var assetsFolder = new Folder(doc.path + "/" + sanitiseName(docName) + "_Assets");
        if (!assetsFolder.exists) return [];
        return assetsFolder.getFiles("*.psb");
    } catch (e) {
        alert("Error finding saved .psb files: " + e.toString());
        return [];
    }
}

function processSinglePSB(f) {
    try {
        var openedDoc = app.open(f);
        app.activeDocument.activeLayer = app.activeDocument.layers["artboardBounds"];
        executeAction(stringIDToTypeID("newGuidesFromTarget"), undefined, DialogModes.NO);
        app.activeDocument.activeLayer.remove();
        openedDoc.close(SaveOptions.SAVECHANGES);
    } catch (e) {
        alert("Error opening " + f.name + ": " + e.toString());
    }
}

function selectAllLayersInGroup(group) {
    var selectedCount = 0;
    var childLayers = group.layers;
    for (var j = 0; j < childLayers.length; j++) {
        var layer = childLayers[j];
        if (layer.typename === "ArtLayer" || layer.typename === "LayerSet") {
            selectLayerById(layer.id, selectedCount > 0);
            selectedCount++;
        }
    }
    return selectedCount;
}

function sanitiseName(name) {
    return name.replace(/[\/\\:\*\?"<>\|]/g, "_");
}

function selectLayerById(id, add) {
    var ref = new ActionReference();
    ref.putIdentifier(charIDToTypeID("Lyr "), id);
    var desc = new ActionDescriptor();
    desc.putReference(charIDToTypeID("null"), ref);
    if (add) {
        desc.putEnumerated(stringIDToTypeID("selectionModifier"),
            stringIDToTypeID("selectionModifierType"),
            stringIDToTypeID("addToSelection"));
    }
    desc.putBoolean(charIDToTypeID("MkVs"), false);
    executeAction(charIDToTypeID("slct"), desc, DialogModes.NO);
}

function deselectAllLayers() {
    try {
        var idselectNone = stringIDToTypeID("selectNoLayers");
        executeAction(idselectNone, undefined, DialogModes.NO);
    } catch (e) {
        app.activeDocument.activeLayer = app.activeDocument.layers[0];
    }
}

function convertToEmbeddedSmartObject(newName) {
    try {
        layerLock("protectNone");
        executeAction(stringIDToTypeID("newPlacedLayer"), undefined, DialogModes.NO);
        app.activeDocument.activeLayer.name = sanitiseName(newName);
    } catch (e) {
        alert("Error converting to smart object: " + e.toString());
    }
}

function layerLock(lockValue) {
    var idapplyLocking = stringIDToTypeID("applyLocking");
    var desc1113 = new ActionDescriptor();
    var idnull = charIDToTypeID("null");
    var ref514 = new ActionReference();
    var idLyr = charIDToTypeID("Lyr ");
    var idOrdn = charIDToTypeID("Ordn");
    var idTrgt = charIDToTypeID("Trgt");
    ref514.putEnumerated(idLyr, idOrdn, idTrgt);
    desc1113.putReference(idnull, ref514);
    var idlayerLocking = stringIDToTypeID("layerLocking");
    var desc1114 = new ActionDescriptor();
    var idprotectNone = stringIDToTypeID(lockValue);
    desc1114.putBoolean(idprotectNone, true);
    desc1113.putObject(idlayerLocking, idlayerLocking, desc1114);
    executeAction(idapplyLocking, desc1113, DialogModes.NO);
}

function convertToLinkedSmartObject() {
    var doc = app.activeDocument;
    var docName = doc.name.replace(/\.[^\.]+$/, '');
    var assetsFolder = new Folder(doc.path + "/" + sanitiseName(docName) + "_Assets");
    if (!assetsFolder.exists) {
        assetsFolder.create();
    }

    var baseName = sanitiseName(doc.activeLayer.name);
    var fileName = baseName + ".psb";
    var file = new File(assetsFolder.fsName + "/" + fileName);

    var counter = 1;
    while (file.exists) {
        var suffix = "_" + ("000" + counter).slice(-3);
        fileName = baseName + suffix + ".psb";
        file = new File(assetsFolder.fsName + "/" + fileName);
        counter++;
    }

    var idplacedLayerConvertToLinked = stringIDToTypeID("placedLayerConvertToLinked");
    var desc346 = new ActionDescriptor();
    var idnull = stringIDToTypeID("null");
    var ref49 = new ActionReference();
    var idlayer = stringIDToTypeID("layer");
    var idordinal = stringIDToTypeID("ordinal");
    var idtargetEnum = stringIDToTypeID("targetEnum");
    ref49.putEnumerated(idlayer, idordinal, idtargetEnum);
    desc346.putReference(idnull, ref49);
    var idusing = stringIDToTypeID("using");
    desc346.putPath(idusing, file);
    executeAction(idplacedLayerConvertToLinked, desc346, DialogModes.NO);
}

function artboardBounds(group, doc) {
    var boundsLayer = group.artLayers.add();
    boundsLayer.name = "artboardBounds";
    doc.activeLayer = boundsLayer;
    var fillColor = new SolidColor();
    fillColor.rgb.red = 127;
    fillColor.rgb.green = 127;
    fillColor.rgb.blue = 127;

    doc.selection.selectAll();
    doc.selection.fill(fillColor);
    doc.selection.deselect();

    boundsLayer.opacity = 0;
    boundsLayer.fillOpacity = 0;
    boundsLayer.move(group.layers[0], ElementPlacement.PLACEBEFORE);
}

 

  1. Copy the code text to the clipboard
  2. Open a new blank file in a plain-text editor (not in a word processor)
  3. Paste the code in
  4. Save as a plain text format file – .txt
  5. Rename the saved file extension from .txt to .jsx
  6. Install or browse to the .jsx file to run (see below)

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

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 19, 2025 Sep 19, 2025

Hello @Stephen Marsh,

I'm testing the script right now and it works wonderfully! 

Really, thank you so much!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 19, 2025 Sep 19, 2025

@arnault_6305 

 

You're welcome!

 

Although designed for the current open document, It could also be recorded into an action for use with the Batch command.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 19, 2025 Sep 19, 2025

@Stephen Marsh 

I’ve never used the Batch function in Photoshop, so I wasn’t aware that was possible... that’s really good to know.
Not sure if I’ll need it right away, but I really appreciate you pointing it out.

Thanks again

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 19, 2025 Sep 19, 2025

@arnault_6305 - I'm curious, what's an example before/after file size for the original PSD file?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 19, 2025 Sep 19, 2025

@Stephen Marsh 

 

I've tested your script a bit more since this morning and some issues arose... but first, I'll answer your curiosity!

 

As a reference my project file had about 60 artboards with each between 10 and 30 layers (all kinds : rasterized layers, smart object, adjustments layers, shape...). Before the linked SO with only artboards the file was at about 13go. After the use of linked SO it goes down to less than 500mo. I haven't used your script on a full project yet since I already had converted every artboards into a linked SO, but I reckon it should show a similar result.

 

I have tried to emulate the use of your script on one of my project by using an old one on which i also had done the conversion manually. I've unlinked and unsmarted everything to get only the Artboards again. Unfortunately, your script doesn't work on this file for a reason I don't know. 

The error popup :

arnault_6305_0-1758285926395.png 

Translation :

Error 8800: A general Photoshop error has occurred. This function may not be available in this version of Photoshop.
Unable to execute this command because the file is not found.
Line: 147
→ executeAction(idplacedLayerConvertToLinked, desc346, DialogModes.NO);

 

 

When I create a new file with fresh artboards it works well! 

But it converts every artboard into a .psb, not only the selected ones (I don't know if it's an error or if it's my fault for not explaining myself good enough :'( ). The issue with that is : I probably won't wait for my Photoshop to crash to make the linked SO. Converting only a small selection of artboards is definitively something i would do.

Since your script preserve the artboards, if it takes every one on the main file I assume It would create another linked SO for each. Even the already converted ones (which also cause a small dysfonctionnement, but it's not too bad).

 

And I have a personal request, but I don't really mind not having it granted : It would be nice to be able to select the folder in which I want the .psb files to go. 

I'm sorry to bother you again with this! 

I'm really grateful for your help 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 19, 2025 Sep 19, 2025

I can't comment on that error, it does sound like it doesn't like working on a "non-original" artboard.

 

You are indeed correct, the script is designed to loop over ALL artboards, not selected artboards.

Let me take a look at that, it was the same in the referenced link where two workflows were supported.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 19, 2025 Sep 19, 2025

@Stephen Marsh -  I've tried a few things to get it to work on my old project file.
Turns out the issue was entirely my fault... It seems the nomenclature was the fault, maybe it's too long or it's because it sometimes contain an "é" or "*" (the whole project name includes either one or both). 
I changed that with shorter names and it works now.
Also noticed that it doesn’t carry over the existing groups from the artboard into the new linked smart object.
I'm really freaking sorry ;;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 19, 2025 Sep 19, 2025

I didn't test for groups, I'll look into the code tomorrow...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 19, 2025 Sep 19, 2025

I want to say apologize again. I was the one asking for this, and it ended up being such a weird issue just because I didn’t check the file name properly...
Really, thank you so much for your patience and help. I’m super grateful you'll take the time to build and adjust the script.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 19, 2025 Sep 19, 2025

@arnault_6305 

 

It's all good, this is part of the "fun" of development!

 

As a native English speaker, I don't test with such accented characters. My code did try to account for layer names containing illegal filename characters.

 

I have updated both code versions to v1.1 to (hopefully) correctly handle groups and nested groups.

 

Let me know how the new versions go!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 20, 2025 Sep 20, 2025

@Stephen Marsh 

 

I'm testing both of them right now and it seems they work!

 

I also did some troubleshooting for the nomenclature issue... turns out it was because the path name was too long (looks like there's a limit of about 260-ish characters for it to work). My folders were just way too nested! It wasn't the file name characters after all; your scripts handle those just fine.


I don't have my big file with me since I'm away for the weekend, but I'll keep you updated when I can try it on larger files.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
15 hours ago 15 hours ago

@Stephen Marsh- Hello Stephen, 

 

I'm back and have been able to test your script on my projects with similar features as the ones I've listed before : about 60 artboards ; 10 to 30 layers of all kind, some with and some without effects applied.  

 

So here's the exact results : 

- My file went from 12,4 Go to 447 Mo

- It took 9 mins to process every artboards

 

The file's size reduction is really amazing, and the time is perfectly fine, as it would take me twice the time to do manually. Furthermore, it allows me to work on other things in the meantime.

All in all, it's perfect for my usage 🙂 

 

Thanks a lot again!  

Arnault

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
15 hours ago 15 hours ago

Thank you for the feedback.

 

The script would be a little faster if you didn't need the 2nd processing step where guides are added to the .psb files, marking the original artboard bounds.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
14 hours ago 14 hours ago

Well, I really don't mind the speed of the script as it is. For me, having the bounds clearly shown is much more important than saving a few minutes on the process.

 

Thanks again for all your work!

 

PS : Would you be okay if I were to modify a few lines of your script in the future, if I need to adapt it for a specific project?
Of course, I’ll keep the original credits and won’t share it outside without your permission.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
14 hours ago 14 hours ago

That is fine. the script is in the public domain, but I appreciate the courtesy.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
12 hours ago 12 hours ago

There are no free lunches...

 

The original file was 12.4 GB.

 

The new file is 447 MB. That is certainly easier to work with.

But what is the total size of all of the new linked PSB files (which may not be a concern, drive space is cheap).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
11 hours ago 11 hours ago

Yes, you're right... The total size of all the new linked PSB files is 20.5 Go (not sure why it grows that much, honestly).
The total size of all files isn’t really a concern for these projects. The main goal was to reduce the size of the main working file and centralize everything in a more manageable way, not to save storage space. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
10 hours ago 10 hours ago

I understand that it's not about size on drive. Anyway, all the .psb files are probably saved with maximised compatibility, so the extra invisible flattened copy adds to the size.

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/batch-remove-maximize-compatibility-f...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
19m ago 19m ago
LATEST

@arnault_6305 

 

Due to the length of the processing time for your files, I have updated both scripts to v1.2 to now include a progress bar (one for the artboard conversion and another for the .psb conversion). This way you will know exactly where the script is at during processing.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines