Counting layers automatically in Adobe Photoshop
- December 4th, 2009
- Posted in Tutorials . Web
- By André
- Write comment

Some time ago I decided there had to be a better way to count how many layers you have in your .psd file in Photoshop. Mostly because its interesting trivia but also because its probably a good idea to not to exceed a certain limit.
So why would layer count be important?
Well, the .psd filesize doesn’t really tell you much more than that the file is heavy. It doesn’t tell you why its heavy, could be because you work with high resolution images, advanced and extensive blending modes or it could be because you have a bizillion layers.
A bizillion layers – why not leave well enough alone?
If the latter is the case, you might need to consider removing a few or merging a few especially if you are a designer and other people are supposed to be able to make sense of your work and that person might not appreciate (perhaps sitting on a not so powerful computer) a ten minute waiting time just to open the file.
File with too many layers
This file is an export file for custom buttons on a web page, in this case the layer count could really take off. Having four states (default, featured, pressed and disabled) in 5-15 different languages – and we don’t want to merge them all since that would rob us from the graphics being usable in the future when our client wants to change something in the buttons (this file has about.. 3.5 thousand layers – almost not usable any more).
File with many layers
Enough blabbering – how do I count them all?
A nice fellow named Kyle Tunney posted a script on his web site some time ago which does all this for you. Running the script on your photoshop file will prompt you with the exact layer count of your current photoshop file.
How to – Step by step
Download the script, note where you save it. Open your photoshop file and click ‘File’ -> ‘Scripts’ -> ‘Browse’.

Find the script and load
Find the script you just downloaded and hit ‘Load’ and then ‘Yes’.

Features
- Counts all the layers of your file
- Counts all groups and layer masks as well (since you you use groups for more than just structure and categorization – this works as intended
Problems with the script
- Files over 100-200 layers might take time to count, you will probably think PS crashed
- There is no progress bar letting you know how far you’ve gone in the counting
- Loading the script and hitting ‘No’ (deciding you don’t want to count layers) will result in the script still counting your layers
- Kyle doesn’t seem that into developing the script further (adding progress bar etc.), ill probably need to do that myself one day
Cheers for the mention and blogging about the script André!!
I hope alls well with you!
Kyle
Cheers to you as well! All with me is well, hope you are too.
Really good article. I find the script mostly useful for trivial purposes but useful nonetheless. I don’t work with photoshop the way you do in this article, but it is always interesting knowing how many layers you have. Mine counted 113!