Skip to main content
chromax
Known Participant
February 24, 2026
Question

Rename and sort layers by AI

  • February 24, 2026
  • 2 replies
  • 21 views

Please AI help us with one of the nastiest things in Photoshop history, the naming and sorting of layers in groups. 

One click and AI sorts and renames layers by its look. Doesn´t have to be perfect and a undo function should be available. But could help a lot. 

And/or V2: I can prompt a set of rules how to clean up my mess. (All buttons in group etc) 

    2 replies

    Stephen Marsh
    Community Expert
    Community Expert
    February 26, 2026

    Not renaming using AI, and not sorting layers into groups… But it may help someone else if naming by blend mode is your thing:

     

    https://www.ps-scripts.com/viewtopic.php?f=66&t=40800

     

    /*
    Selected Layers to Blend Mode Name v1.jsx
    v1.0, 25th June 2022, Stephen Marsh
    Based on the code that I wrote for:
    https://www.ps-scripts.com/viewtopic.php?f=66&t=40800
    */

    #target photoshop

    function main() {

    // Save the current dialog display settings
    var savedDisplayDialogs = app.displayDialogs;
    app.displayDialogs = DialogModes.NO;

    // Select all layers
    app.runMenuItem(stringIDToTypeID("selectAllLayers"));

    // Get the selected layers: courtesy of jazz-y
    var s2t = stringIDToTypeID;
    (r = new ActionReference()).putProperty(s2t('property'), p = s2t('targetLayersIDs'));
    r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
    var lrs = executeActionGet(r).getList(p),
    sel = new ActionReference();

    // Loop over the selected layers: courtesy of jazz-y
    for (var i = 0; i < lrs.count; i++) {
    sel.putIdentifier(s2t('layer'), p = lrs.getReference(i).getIdentifier(s2t('layerID')));
    (r = new ActionReference()).putIdentifier(s2t('layer'), p);
    (d = new ActionDescriptor()).putReference(s2t("target"), r);
    //d.putBoolean(s2t("makeVisible"), false);
    executeAction(s2t('select'), d, DialogModes.NO);

    // If layer name = Layer 1 | Layer 02 | Layer 003 etc. (case sensitive)
    if (app.activeDocument.activeLayer.name.match(/^Layer \d+/)) {
    // Call the layer rename function
    lyrNameToBlendName();
    }
    }
    // Finish the loop

    // Restore the dialogs
    app.displayDialogs = savedDisplayDialogs;
    }


    function lyrNameToBlendName() {
    var lyrBlendMode = app.activeDocument.activeLayer.blendMode.toString().replace(/(?:^.+\.)(.+)/, '$1');
    var lyrBlendLC = lyrBlendMode.replace(/LIGHT$/, ' LIGHT').replace(/MIX$/, ' MIX').replace(/COLOR$/, ' COLOR').replace(/DODGE$/, ' DODGE').replace(/BURN$/, ' BURN').replace(/LINEAR DODGE$/, 'LINEAR DODGE (ADD)').toLowerCase();
    var lyrBlendPC = (sentenceCase(lyrBlendLC));

    function sentenceCase(str) {
    /* https://www.geeksforgeeks.org/convert-string-to-title-case-in-javascript/ */
    if ((str === null) || (str === ''))
    return false;
    else
    str = str.toString();
    return str.replace(/\w\S*/g,
    function (txt) {
    return txt.charAt(0).toUpperCase() +
    txt.substr(1).toLowerCase();
    });
    }

    var suffix = app.activeDocument.activeLayer.name.replace(/(?:.+)( \d+$)/, '$1');
    app.activeDocument.activeLayer.name = lyrBlendPC + suffix;
    }

    // Single history stage undo
    activeDocument.suspendHistory("Selected Layers to Blend Mode Name v1.jsx", "main()");

     

    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?m=1

    Sameer K
    Community Manager
    Community Manager
    February 25, 2026

    Hey, ​@chromax. Welcome to the Photoshop Community. Thanks for bringing this up. 

    Photoshop’s AI Assistant was made available during the MAX in Oct’25. Head here to learn more: https://blog.adobe.com/en/publish/2025/10/28/our-view-agentic-ai-assistants-that-work-you-in-your-favorite-apps

    Please check if the private beta in Photoshop Web is available for you to try in here: https://photoshop.adobe.com

     

    I’ll merge your post into existing requests for the same feature set soon. Thanks!

    Sameer K