Split to Layers

This script will separate each contiguous group of pixels to its own layer.

In the example below, the layer “Image” was split into 3 separate layers.

split

Download “Split to Layers” script

45 Responses to “Split to Layers”

  1. Indo Says:

    Simply brilliant. Big thanks. I can’t wait to when there are three times as many scripts!

  2. The Insaint Says:

    Nice, but it throws an error after the dialog -> “the object current document is not currently availabel”
    Not useable on CS6

    • David Jensen Says:

      I created and tested it with Photoshop CS6, Standard and Extended, on both OSX and Windows. Can you give me any other info? Can you get it to work on something simple?

      Sometimes there is some initial state I didn’t anticipate, like the layer is locked, a path is active, quick mask mode is on, color mode is set to indexed, etc. (It shouldn’t fail in any of those specific cases, though)

      • The Insaint Says:

        Well … actually there isn’t any more info. :(
        I create a document, 500x500px, painting some strokes, then call the script. It starts, but soon, like after the first extraction, it stops with an error:
        Error: General Photoshop error occurred. This functionality may not be available in this version of Photoshop. – The object “current document” is not currently available.

        I tried on the locked background, I tried it on a transparent layer.
        Photoshop CS6 (13.0) on Win7 64Bit

        • David Jensen Says:

          Have you updated to 13.0.1.1? I don’t know if that will help.
          If that isn’t it, I really don’t know. There have been a few hundred downloads of the script, and this is the first I’ve heard of any issues.

        • David Jensen Says:

          I just tested it on a copy of PS CS6 with no updates and it worked fine. Sorry, I really don’t know why it isn’t working for you :-/

    • ABER Says:

      make sure to unlock the layer that you want to split buddies
      it works!
      :)

  3. The Insaint Says:

    I haven’t updated PS, as I’m one of those many out there, where the updates don’t work/install (I’m no Adobe Cloud Member).
    Too bad, looks like I have to let this slip. :(
    Thanks anyway for the reply.

  4. The Insaint Says:

    Update: With help from Adobe Support, I was able to update to 13.1.2. Now the script works as expected.
    Great job.

  5. Alexander Says:

    This script grabs only full visibility pixels (when tolerance = 0)…
    How to remake it the script grabs no-full visibility pixels too (when tolerance = 0)?
    Answer please.

  6. Valerie Foster Says:

    This is fantastic. If I were able to append the filename with sequential letters of the alphabet, it would be perfect for my needs. Please stay in touch if you’re able to make these changes, I’ll happily come back and donate!!

  7. ABER Says:

    make sure to unlock the layer that you want to split buddies
    it works!
    :)

  8. Bernd.Kay Says:

    Works like a charm.

    One thing I miss so.. I often use complex forms imported from illustrator. If I split these with the script, they lose there form tag and get rastered. Any chance to keep them as vectors?.

    Right now I do it by hand. Select form with pressed Alt-Key, then new layer with Strg+Alt+J Keys..

    ANyway thanks alot! :-)

  9. Federico Says:

    Awesome, thanks! I wish this were available for Fireworks or Pixelmator, though.

  10. vik Says:

    hi I got Error: General Photoshop error occurred. This functionality may not be available in this version of Photoshop. – The command “Expand” is not currently available.

    what should I do?

  11. Konstantin Says:

    Thank you SO SO SO much! Works like a charm!

  12. GrutBrushes Says:

    What a great script! Thank you so much. If anyone is wondering, yes, it works perfectly in Photoshop CC 2014 Win 8.1 (select File->Scripts->Browse)

  13. mohamed osman Says:

    thanks!!!!!!!!!!!!!!!!!!!!!!!!! :D :D :D

  14. kakkakakaaaax Says:

    A BIG BIG thank to the Author, you are AWESOME, working perfectly on PS cs6 win 64bits!!!!

  15. Wambosa Says:

    This tool works great! i was about to write one myself for imageMagick, but who has time for that!

    When Getting this error:
    The command “Expand” is not currently available.
    Make sure that there are actual transparent pixels on the image. I found that if there are not any real transparent pixels, then this error comes up.

  16. Gaurav Ramanan Says:

    Just too awesome! EXACTLY what I was looking for. The example is a bit misleading though. At first I thought maybe the contiguous group of pixels need to be of the same colour! But this script does way more hard work! Cheers n Thanks!

  17. K Says:

    Hello my when I open script it asks how many pixels for continuous gap (may have the wrong) i leave 0 and all it seems to do is copy the photo with no layers

  18. Jill Schmehl Says:

    THANK YOU!!!

  19. J. Ferrand Says:

    Thank you. Very good work!!
    It works flawlessly!!!!

    It could be even better if it assumes the default values for gap and layer naming, after recording an action. As it is, you must press enter when asked for this values in the middle of an action.

    Photoshop CC 2015.1.1 on Mac OSX 10.11.2

  20. info@raypan.me Says:

    Oh my god! Saved my life!!!

  21. Yakoe Nicol Tablado Says:

    amazing thanks

  22. Jim Says:

    fantastic, works perfect. thank you greatly

  23. Erik Verheij Says:

    Thank you so much, this is very useful!

  24. Thor Sarup Says:

    So useful!! awesome script.

  25. Flávio Max Says:

    Wooooow! u saved my day! Even for CC 2019 that miracle tool still working very well! Hugs from Brazil!

  26. Bex Says:

    Just found this script and it is genius!! As a pattern designer who imports original artwork into photoshop, but then needs each motif on a different layer, this is going to save me HOURS of using the lasso tool and pasting into layers. Thank you so much!!!

  27. Peter Says:

    Works with CC 2020. Thank you so much.

  28. Jose Says:

    Woow this Script is Amazing!!! Thank you so much for sharing, I been cutting pieces by pieces on some pictures that have 200+ pieces, was really crazy I almost giving up and this script did it on on a few seconds, so lucky to find it.
    It should be included on Photoshop by default
    Keep up the good work, You are Awesome )))

  29. Andy Says:

    Saved me about 2 hours of work. Thank you!

  30. Toni Says:

    22.5. Error: General Photoshop error occurred. This functionality may not be available in this version of Photoshop.
    – The command “Layer Via Copy” is not currently available.

    Layers with identical content gets duplicated, no objects are split individually.

    Transparent file, unlocked.

    28/01/2023

  31. Toni Says:

    Toni here, script works great. I had no idea Photoshop went 2 levels up. I feel I updated just recently…. After updating to latest it works.

Leave a reply to The Insaint Cancel reply