Counting Layers In Photoshop

May 11 | 2008         Write a comment

Have you ever wanted to know how many layers are currently in your .pdf/.psd file? Simple, the answer is 3, or 8 or even 17. I’m not talking about simple files like this one.

 

Three layered .psd in photoshop

 

Ok, so clearly you can work that one out for yourself…. theirs three layers in that file. How about this file?

 

 

So this image is a bit more of a strain to count, it would probably take five, maybe ten minutes to count the layers. Theirs only 45 layers but this can all take time if you have to count them yourself. What if your images start to get really big (not filesize) but regards layers. Do you really have the time to count hundreds of layers? Would you have the patience?

The following will help you get around this!
Photoshop Layer counting script – This script will count all the layers for you automatically!

 

So I’m sure you want to know how to use this?
It’s simple!!

  • Right-click the above link and download the script to your desktop
    (or somewhere you will remember)
  • Open up Photoshop with the file you wish to count
  • Click on ‘File’
  • Then ‘Scripts’
  • Now click ‘Browse’
  • Find the script you just downloaded to your desktop and click Load
  • You will now be prompted with ‘Go through your file and count all the layers??
  • Click ‘Yes’
  • You will now be informed of the amount of layers in your file!

Job done, that was a lot quicker than counting 20-5,000+ layers now wasn’t it?

 

I hope this script speeds up your photoshopping someday :)

 

 

This script is used at your own risk, I have personally used it many times but shall not be held responsible for any misbehaviour caused by it!

 

 

Category
Tutorial
Tags
,  
Related Articles

Leave a comment | Ask A Question?

 

  1. Not sure why you would need to know how many layers you have, but actually attempting to work with something like that seems so very very daunting to me.

     
  2. Hey Phil,
    Sometimes in projects/competitions a file under 10mg would be asked, the odd time people like to make it a little quirky by saying ‘less that three layers’. Obviously people can just merge some of the layers but that would be pretty easily noticed when judging the final .psd/.tiff.

    I’ve also seen 1/2topics on some forums asking the question “Is there any easy way to find out how many layers I have in Photoshop?” – so I thought I’d write this easy article. I’ve never actually had to use this myself but was always interested in finding out how many layers I used in the picture used above.

    Thanks for posting Phil!

    Kyle

     
  3. Thanks for this script bro! I usually have hundreds of layers in a project and it’s hard to keep the count in track. I need the layer count for my portfolio :)

     
  4. nice tool Kyle!
    i was having a hard time counting all the layers of the vectorized photo i’m working on. then i thought, there must be an easy way to count all these layers. and your script was the answer!
    it had 274 layers all in all. thanks man!

     
  5. Glad it helped lads :)

     
  6. beautiful! thank you very much!

     
  7. thanks! this was really useful, I do vector art with photoshop and I use ~500 layers depending on the source photo and I like to know how many I’ve run up.

     
  8. Thanks …just what I was looking for! :D

    Current document: 1107 layers !!

     
  9. Thanks for this! I’ve been curious about layer amounts before but only recently has it become a requirement, so this is going to come in very useful. I appreciate you sharing this.

     
  10. Hey Kyle!

    Thanks for this script, not that I needed it but I was curious about my latest project file. Now my question is: does it count all the layers that are in groups too? or is a group counted as one layer?!

    Cheers, phil

     
  11. Thanks for the comments lads.

    Phil,
    Sorry I forgot to mention in the original post, All layers will be counted even if their in a group. There’s one little snag though, the group itself will be counted as a layer. So if you have two normal layers and then two more layers in a group, you will be told that you have five layers…
    I hope that answers your question!

     
  12. Hey Kyle, thanks for this script! Curiosity gets the better of me some times and this is really handy!

     
  13. Thanks man, this is pretty much exactly what I needed.

    I broke my record this morning, up to 45 layers in this (maybe another 20 to go…). I wasn’t about to make the habit of counting how many myself. Great script.

    Thanks a ton, dude!

     
  14. Thank man, great job on the script. I layer stack photos one at a time for work, and at the end i need to know how many object (layers) i have. this just made my life a whole lot simpler. thanks bro.

     
  15. I’m glad the script helped guys!

    Kyle

     
  16. Thanks Kyle-

    265! Will have to try it on some of my bigger files as well.

     
  17. No problem Jeremy. Some cool animations on your site!
    Keep up the good work!

    Thanks for stopping by!!
    Kyle

     
  18. Hi!
    Real nice sript. It is very useful since I rarily work with files with less than 200 layers and its always nice to know how many layers there are in the project.

    There is a problem though – If I have a file with 1000 – 5000 layers (which happends when designing a hefty website) – it takes way too long for the scrit to count them and there is no way to cancel the script or see how far in the progress the counting has come. Is this something you could develope? It would be much appreciated.

    Otherwise I will have to initiate the script when I leave a friday night and see the result on monday morning. ^^

    /André

     
  19. Hi André,
    I’m glad you like the script! Wow 1-5k layers for a website? As a web designer myself I’m stunned that you could have something that colossal. At the moment I’m swamped with work so I won’t be updating the script any time in the near future.
    Sorry!

    From a web design point of view maybe break all the pages on the website up into seperate files. So have .psd for your homepage, one for your contact page etc?

    Hope that helps,
    Kyle

     
  20. Reply –
    I see, its a pity you won’t continue with the script soon. This is actually the top search at google for photoshop layer count =) A progress bar would be useful, and a step in the right direction in user-friendlyness ^^

    The reason I don’t really split my projects into numerous files is simple – I have a monster machine of a computer and get no lesser performance in high layer count. Lately I have had to split sited and designs up though, due to other people using my design source files. I definitly see a great point to it.

    Even so, I seem to get a really high layer count, with layer compositions, graphic source-files, notes-layer-groups, work-groups and replicated groups used all over the design.

    When I get the time, maybe I will continue on your script and add these things =) Regardless, I will link to this blog from my own site (not yet operational).

    Thank you however. /André

     
  21. sup kyle

    thanx for the script man, im doin some vector work and i wanted to know how many layers i had, just wanna ask does it count layers inside smart objects too?

    thanx for the script man, 134 layers and counting!

     
  22. Kyle, your script is extremely appreciated! 697 layers I did not have to count!!!!! Kudos!

     
  23. Great article, adding it to my bookmarks!

     
  24. Thanks man…..I wish it didn’t count the Groups. Is this possible? Future version maybe?

     
  25. Hey Dustin,
    Thanks for the comment. I may update it in time to come.
    In the meantime you could always just delete the group in question before you run the script and then undo.

    MAKE SURE to have a backup of the file, just in case!!

     
  26. Dustin-
    Actually, I think groups should and must be included in the layer-count since they actually fill as vital functions as a layer do, not just folders and categorizers. If I use a group to mask all its content or something like that – shouldn’t that count as a layer? In that case, should really clipping masks and adjustment layers count as well?

    I think its just as valid in the count as regular layers =)

    Still using the script – awesome.

     
  27. I’d agree with you Dustin!
    I use a fair amount of groups and it’s purely for structure/organising. I always need the layers within my groups :)

     
  28. Hey very nice blog!! I will bookmark your blog..

     
  29. Wow, thanks. This script is great. I just used it on a doc with 266 layers in Photoshop CS4. Works like a charm! I found this just by searning Google for “how many layers in my PSD.”

    Thanks!!

     
  30. Glad it helped Joel :-)

     
  31. Thanks This Is Very Very Useful.

     
  32. Great script!
    thanx a bunch…
    working on some complicated website UI designs, with loads of grouped layers.. thought I had about 100 or so layers.
    Once I ran the script and the result was 375 layers….

    I wish Photoshop had a layer index numbering like After effects does, just before the layer name, as well as a lock right there and not at the top of the layers palette.

    Could a script count the groups as well like a hierarchy list?
    Counting the topmost groups, the sub groups and all the layers?
    tks

     
  33. Crashed my CS3 :p

     
  34. Sorry to hear that bob. I’ve used this well over one hundred times on different files in CS3 and never had a problem. It might have been something else… or a plugin that conflicted with it perhaps?

     
  35. Bob, I thought I got that behaviour as well.. but it turned out it was still counting the layers. It freezes PS and doesn’t show a progress bar so its hard to know what its up to.

    If you have 500 + layers, it might take some time for it to finish counting.

     
  36. yeah.. a progress bar with the layer numbers dynamically counting would be cool.

     
  37. Evan, indeed =)

     
  38. WOW. This script just made me squeal with glee. This is PRECISELY what I needed for digital painting. I’m trying to get into the habit of keeping all my layers, and this just sold me. In return, a link to the image I just finished and used your script to count layers in.

    (88 was the count, incidentally. Though I did some thorough merging at the bottom.)

     
  39. Sweet image Joe! Glad the script helped you!

     
  40. super useful, thanks!

     
  41. Works fine for me when there only a couple of hundred layers, but it crashed my CS4 when i tried it on real big files. Will try it again on a faster pc when i’m at work.

     
  42. Nice script, thanks for sharing!

     
  43. Many thanks for this script!

    I am working on a new project which is probably the graphically intensive one I’ve done to date. I’m not half way through the layout and already have over 200 layers.

    Thanks again.
    aFX-D.

     
  44. [...] gibt ein Skript, das für euch die Ebenen zählt. Das habe ich auf dieser Seite gefunden: Kyletunneyphotography-Blog. Hier der Direktlink zum Skript. Es kann sein, dass Eurer Browser das Skript nach dem Download aus [...]

     
  45. Hmm, posted May 2008, and still highly usable! ;) Just started a photo manipulation and it’s on 185 layers! :> That indeed, was faster than counting myself!

    Thank you (:

     
  46. Glad to help Danny!!

     
  47. I downloaded it, but it’s so slow that I literally waited 15 minutes and it was still counting. It’s relatively pointless, as any number that’s too hard to count is just too much for this script to handle.

     
  48. Hi Dalton,
    Sorry to hear the script is a bit sluggish for you. You can see from the comments above that it works on files up to 1,000 layers with absolutely no problems. This script was written more than a year ago with the idea to help the average graphic designer/photographer to count their layers in photoshop. Theirs probably only a handful of people who would go over 1,000 layers in photoshop. Sorry this didn’t do the trick for you.

    Kyle

     
  49. Dalton, yes I agree. I sometimes need to initiate the script when im off from work and see the result when I get back the next day. A good day I can leave it on when I gof to lunch though.

    I think this script is best suited for files with less than 200 layers. At least until a feature with progressbar is developed – or things are just optimized really well (havn’t read the script very thuroughly so I don’t know the extent of current optimization).

     
  50. Keep up the good work.

     
  51. I think this is a wonderful script! I have always manually counted the layers which is daunting. Some may not understand why one would need to know how many layers, but sometimes bragging is enough. :D Thank you for this.

     
  52. OMG!! Thanks a bunch!!

    I’ve been looking for something exactly like this!!
    :]

     
  53. [...] nice fellow name Kyle Tunney posted a script on his web site some time ago which does all this for you. Running the script on [...]

     
  54. This is awesome i started to count layers but i found this script and worked great.
    Layer count on a Virtual DJ skin im making: 985

    Thanks to the creator of this script

     
  55. 1059 layers and counting :)

    To be fair that’s split over 30 layer comps

     
  56. Glad to help guys!

     
  57. Thanks for the script, just used it in Photoshop CS4 and I have far more layers than I thought!

     
  58. Just what i needed…tnx a lot!

     
  59. Vielen Dank. ;-)

     
  60. hey kyle,

    would love it if your script would give a more detailed output. as for my work it would be great to see the count of visbible vs. unvisible
    layers. e.g. ( your doc has 101 layers / 23 visible)
    an option to count folders and their content as one layer opposed to count all layers regardless of their structural order would be great, too. last but not least if the script could run as a panel similar to the “info” constantly giving out layer and (un)visible count i’d be perfekt.
    i appreciate your work.

    greetz

     
  61. Great idea Stefan. I’d love to work on this a bit more but have so much going on at the moment with work that it’s hard to find the time. Hopefully sometime in the future!

    Kyle

     
  62. Hi!

    Thanks a lot for this script. It is actually very useful to me. Do you guys know if its any way tho to modify it to count the photoshop groups instead of the layers? That would be so awesome to me to be able to count the groups.

    Thanks!
    Em :)

     
  63. Hi Em,
    I’m sure it’ i possibly but I’m afraid I don’t have the time to update the script at the moment.

    Kyle

     
  64. would love it if your script would give a more detailed output. as for my work it would be great to see the count of visbible vs. unvisiblelayers. e.g. ( your doc has 101 layers / 23 visible)an option to count folders and their content as one layer opposed to count all layers regardless of their structural order would be great, too. last but not least if the script could run as a panel similar to the “info” constantly giving out layer and (un)visible count i’d be perfekt.i appreciate your work.
    +1

     
  65. I just created an extremely complicated Info-Graphic to explain the movie ‘Inception’ for a contest on FastCompany.com, and I am super, super-grateful for this script. Thank you so much Kyle, from the bottom of my heart.

     
  66. wow, that was a great help, nice use of photoshops “script” feature!!!! :D

     
  67. thanks! This script should be included in photoshop itself. Btw. My psd has 530 layers so far.

     
  68. Cool, thnx!

     
  69. Glad to help guys!! :-)
    Happy counting your layers!

    Kyle

     
  70. Been looking for something like this for AGES!

    111 Layers, at the moment, by the way, :)

     
  71. This did not only make PS CS5 crash for me but also destroyed the file i was working on. Glad I backed it up before trying this out.

     
  72. What’s up Kyle,

    Have one question? – What about this script supporting Photoshop CS5? I been working with older version of the photoshop, like CS3 before, and this script worked with no doubt sickest script on the PS, but when I decided to move on the further, newer version such as CS5, this script seemed to crash ps cs5 while it counts my layers, so is this script only for the older photoshop versions, or it’s something to do with me or my photoshop & computer?

    Waiting for your feedback,
    dldesign.

     
  73. What’s up Kyle,

    Have one question? – What about this script supporting Photoshop CS5? I been working with older version of the photoshop, like CS3 before, and this script worked with no doubt sickest script on the PS, but when I decided to move on the further, newer version such as CS5, this script seemed to crash ps cs5 while it counts my .psd file containing 1000-2000 layers in it, so is this script only for the older photoshop versions, or it’s something to do with me or my photoshop & computer?

    Waiting for your feedback,
    dldesign.

     
  74. Hi Daoud,
    Apologies that this script supposidly destroyed your file but from the amount of use this script has got this is the first time has ever happened. The script doesn’t write anything to the file, so I can’t see how this could have destroyed it on you…

    Hi Laury,
    Thanks for your comment. I haven’t been updating the script or testing it on newer versions of Photoshop. I’ve just tested it on Photoshop CS4 and it works perfectly. There might have been a change in how some parts of PS-CS5 have been coded which stop this script from working correctly. I’m afraid I don’t have the time to work on upgrading the script….. Have you tried using it on a few different psds/tiffs, one’s with different count of layers etc?

    Thanks for stopping by guys,
    Kyle

     
  75. Thanks for the feedback first of all buddy,

    Well everything is aight with my file, because I saved it before counting all the layers, thankfully hah. You know, it’s kind of weird shit happens, when I open that script. Once I’ve opened it and clicked on ‘OK’ button in the little window which ask you ‘Count all the layers?’ or something like that, for that time it seems to be everything fine, but after about 5 or even 10 seconds my photoshop cs5 stops responding, and I just have to shut it down.

    Anyways, I’ll try it with 20 or 30 layers, it might be because of lots of layers or something.

    Thanks once again, best regards,
    laurynasl. :)

     
  76. I just used this script with Photoshop CS5 and it worked amazingly well. I had an illustration composed of logos supplied by a client and I wanted to be sure they were all used in the finished product so I compared numbers in the folder of logos and the finished artwork. 199 layers, it matched and I can stop worrying if I included them all. Thanks!

     
  77. thank you very much
    this is very usefull!

     
  78. very nice script, thanks for that! i usualy try to keep the layers down as much as possible, cuz i cant get quiet laggy. thanks god there are smart objects! my last file had 1400 layers

     
  79. PS CS5 – TIFF – LZWcomp – 1043 Layers – 3 min. to read

    works nice : ) thx!

     
  80. Genius!!!!!!!!!!!!!!!

     
  81. Thanks for the littel tip :-) Fun to see who much you have done..

    So far my counter gets to: 1419
    (Image)
    http://peecee.dk/upload/view/324069

     
  82. Thank you:) it worked perfectly.

     
  83. Seems that this script freeze psd if there is more than some 300 layers :(

     
  84. Hey,
    Thank you for this script! When I downloaded on mac for some reason it was converting it to a .txt file. I renamed the file and got rid of it and it works! This is very helpful for comparisons and making sure you have included everything in a project. Thank you very much!
    Layers: 106!

     
  85. This just made my job a tad easier, thank you!

     
  86. The only problem with this script is that it froze my system and didn’t count the layers in my Photoshop document.

    0/10

     
  87. A WONDERFUL script. Thank you for the effort of making this and sharing it.

     
  88. Great script! Thank you for the effort of writing it!

     
  89. Thank you sir! I had a photoshop file with multiple website mockups in it. It was getting to be over 300mb so I was curious how many layers it had. Turns out it was 492 LOL. Glad I didn’t have to manually count that :P

     
  90. its amazing
    thanks
    is there any way to merge it with the Photoshop
    i mean open any menu and find it and simply press on it :)
    another question:
    can i use it with illustrator ? and if not ; may you do a favor and innovate another one for it :)

    thanks man you are the best ;)

     
  91. Hey Gerglys,
    I’m afraid I don’t use illustrator so I don’t know if it works.

    Regards to running it within photoshop easier, you could try create an action and just do the instructions above and stop the action. Hopefully that will work for you.

    Kyle

     
  92. It works but it needs about 10 minutes to count 490 layers in a 500MB psd with CS6.

     
  93. On a 2 year old Macbook Pro, that is

     
  94. Brilliant-Thankyou!

     
  95. Hey.
    I just wanted to say thanks! It’s a pretty cool script.

     
  96. Thank you so much!!

     
  97. Thank you for making this available. It’s so handy and easy to use. I was curious about a file I just finished (an illustration) and wanted to count the layers. Thank you!!!

     
  98. I have downloaded your script but it failed in Photoshop CS 6 (german).

    Error 61: unclosed token.
    Line: 36
    ->

    Thank you anyway :)

     
  99. maybe i’m blind but i coudn’t find the link ._.

     
  100. Perfect, works like a charm. Thanks for that one buddy.
    I prefer to know how many layers large PSD projects run me. Helps me keep track and optimize my layer count for better responsiveness.

    For reference: Counted 159 Layers in a 8x4m PSB (2.25GB) in less than 10 seconds.

    @ O_O
    The text above it was hyper linked.
    http://www.kyletunneyphotography.com/downloads/count_layers.jsx

     
  101. I have no real need to actually count my layers, but i the inner geek just needs to know.. LOVE this script!!! Thank you so much!

     
  102. Very interesting script. Took 32s to count 332 layers of my file, a 230MB file. But there is some undocumented features hidden in here. When the dialog shows up asking if I want to “Go through your file and count all the layers??”, if I click ^Yes^, which is the obvious answer (why would I say No? :-)), it will use the recursive method (very neat, by the way) and this method is the one that takes 32 seconds to count all 332 layers (groups included). But, and here is the thing, if I click “No” to that dialog, it will NOT not count (= it WILL count) the layers but instead it will count them anyway but using a probably newer version of the routine (that even allows you to exclude the background layer and the groups from the total count) and this routine takes only one or two seconds to come up with the same answer! Awesome!!

    The problem with the first method, that takes a long time to count the layers in heavy files, is that, to add a progress bar, you would need to know first how many layers you have to feed the progress bar, which is catch-22 situation. Then, you can now use the 2nd method to get the total number of layers quickly and then use the result for the progress bar of the 1st method… hahaha… that would be funny!

    Great code, mate, congrats.

     
  103. 6 years after you published this, it has just helped someone!

    Thanks! :D

     
  104. Hi people! Here’s my version of this mega-useful script :)
    var totalProgress = 0
    var laySets = 0
    function layerCounter(inObj)
    {
    laySets += inObj.layerSets.length
    totalProgress += inObj.artLayers.length
    for (var i=0; i < inObj.layerSets.length; i++) {
    totalProgress++
    layerCounter(inObj.layerSets[i])
    }
    return totalProgress – laySets
    }

    function main() {
    alert("Layer count = " + layerCounter(app.activeDocument) + "\nGroups Count = " + laySets)
    }

    main()

     
  105. minor update. now it’s showing total and visible layers too:
    var totalLayers = 0
    var laySets = 0
    var visibleLayers = 0

    function layerCounter(inObj)
    {
    laySets += inObj.layerSets.length
    totalLayers += inObj.artLayers.length

    for (var a=0; a < inObj.artLayers.length; a++) {
    if (inObj.artLayers[a].visible) visibleLayers++
    }

    for (var i=0; i < inObj.layerSets.length; i++) {
    totalLayers++
    layerCounter(inObj.layerSets[i])
    }
    return totalLayers – laySets
    }

    function main() {
    // alert("Total Layers Count = " + layerCounter(app.activeDocument) + "\nGroups Count = " + laySets)
    alert("Total Layers = " + layerCounter(app.activeDocument) +
    "\nVisible Layers = " + visibleLayers +
    "\nGroups Count = " + laySets)
    }

    main()