Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe Photoshop How do I duplicate multiple PS layers (lots of them!) so that each layer is below its copy

  • How do I duplicate multiple PS layers (lots of them!) so that each layer is below its copy

    Posted by John Russell on June 18, 2014 at 12:57 pm

    Anyone know how to duplicate multiple Photoshop layers (hundreds of them!) so that each layer is below its copy, i.e. rather than all the copies being in one group and the original in the other (as normal)? Hope this posted in correct forum. Would be grateful of any advice.

    E.g. from this:
    layer4
    layer3
    layer2
    layer1

    Duplicated to this:

    layer4 copy
    layer4
    layer3 copy
    layer3
    layer2 copy
    layer2
    layer1 copy
    layer1

    Rather than this:
    layer4 copy
    layer3 copy
    layer2 copy
    layer1 copy
    layer4
    layer3
    layer2
    layer1

    Jovan Strel replied 12 years ago 3 Members · 2 Replies
  • 2 Replies
  • Jonathan Ziegler

    June 19, 2014 at 5:59 pm

    Not sure what version of PS you are using, but here is a simple script I lifted from the Photoshop CC Javascript guide (“ArtLayer.jsx” page 62-4) and it seems to work here on CC (if you want to change the sort order, change “ElementPlacement.PLACEAFTER” to “ElementPlacement.PLACEBEFORE”):

    // sort the layers by name
    for (var x = 0; x < app.activeDocument.layers.length; x++) {
    for (var y = 0; y < app.activeDocument.layers.length – 1 – x; y++) {
    // Compare in a non-case sensitive way
    var doc1 = app.activeDocument.layers[y].name
    var doc2 = app.activeDocument.layers[y + 1].name
    if (doc1.toUpperCase() > doc2.toUpperCase()) {
    app.activeDocument.layers[y].move(app.activeDocument.layers[y+1], ElementPlacement.PLACEAFTER)
    }
    }
    }

    If you are going to use this often, I suggest saving it in a plain text editor as sort.jsx or something similar (the .jsx extension is necessary for PS for most current versions) in the startup scripts folder for photoshop so it loads everytime and you can attach a hotkey, too.

    Lemme know how it works.

    Save early. Save often.

    Jonathan Ziegler

    http://www.electrictiger.com
    520-360-8293

  • Jovan Strel

    July 10, 2014 at 11:06 am

    yeah i think there a easier solution, you could just record a action doing following steps
    1. Copy leyer or ctrl+J
    2. Layer>Arange>Move down layer

    end script, assign a shortcut and that would be that

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy