Tell me more ×
Graphic Design Stack Exchange is a question and answer site for professional graphic designers and non-designers trying to do their own graphic design. It's 100% free, no registration required.

I am a web dev and competent in Fireworks but not so much in Photoshop.

I have just received a layered PSD file to turn into a web page. Can anyone tell me the easiest way to export all layers to individual png files?

There are lots of layers and doing this manually seems wrong.

I have seen this but it does seem there should be native functionality for this in PS.

I have access to Photoshop CS4. Any pointers appreciated.

share|improve this question
Is there any way to avoid having the .pngs turned into Index mode? I need them RGB. I could probably just create a droplet for it, but didn't know if there were an easier way... Thanks for the tip though, this is great! – user2995 Nov 25 '11 at 23:17

migrated from photo.stackexchange.com May 10 '11 at 18:18

3 Answers

up vote 29 down vote accepted

File >> Scripts >> Export layers to files...

enter image description here

Here are some related questions...

Exporting individual layers in Photoshop, keeping their sizes

Export Layers to Files exports only 4 png files from 100 layers

EDIT

I spent some time and wrote my own script file to automate this process. This process is much faster than the built-in script mentioned above.

The script can be found here. (last updated May 25, 2013).

Alternatively you may view the source here.

Special thanks to escalation746 for doing some clean-up work on my script (it was really bad).

I ran this script on a 100 layer, 450MB file in under 60 seconds. Running the built-in script on the same file takes me about 30 minutes.

Please let me know if you run into any issues with the script.

Instructions for use: File >> Scripts >> Browse (then find the script)

Here are screenshots to help if you need additional help.

IMPORTANT: The images will automatically be saved in whatever directory your multi-layer file is contained in! Feel free to make any adjustments to the script as needed.

Disclaimer: Please use script at your own risk

share|improve this answer
Good answer - apoligeis for the original post being in photography had no idea Graphic Stackexchange existed! – user256888 Jun 9 '11 at 9:19
Thank you for your answer and this does seem to work on simpler files...but... the more experience I have of this the more laggy it seems. The PSD files I get arent massive maybe 100 layers tops but running the above technique seems to take hours (literally) and hangs and errors quite a lot. My PC is half decent but this process seems to run it into the ground - am now on CS5 but this has become unworkable any more suggetions please? – user256888 Aug 29 '12 at 22:03
I wrote my own script that does this process much faster. Let me know how it goes! Cheers. – Johannes Sep 1 '12 at 3:18
+1 For coming back and providing the script - it sounds great. One thing when I run it on a psd with multiple layers it always throws an alert saying ".....this document contains 1 layer continue?" but it actually contains many more layers? I think I might be missing something as mentioned I'm not a PS expert! Thanks – user256888 Sep 4 '12 at 10:41
That's weird. What version of Photoshop are you using? Could you give me more information on the types of layers they are (regular raster layers, text, masks, etc.)? I can't seem to replicate your problem. – Johannes Sep 5 '12 at 2:11
show 5 more comments

CREDIT GOES TO JOHANNES FOR CONTRIBUTING THE FILE. THANK YOU SO MUCH!

I have added a function that helped me go through my 2448 layer file in about 3 hours.

Here is the link to the modified file Download Here

share|improve this answer
Glad to have helped. I assume the change is that you hide all other layers? – Johannes Sep 2 '12 at 4:48
Yes cause with a big file like that it would take forever to manually hide all layers. For some reason when i tried your original script it would save the files with all the layers visible which would have a output png with all layers visible. Which was weird. So i added the function to hide all others layers except current one then save then hide it. – Mike June Bug Captain Sep 2 '12 at 8:10
Oh my! I forgot to take into account transparency, you're right. I just have it turn off the top-most layer. I'm actually building a slightly more customizable script, and I'll add your transparency thing in. – Johannes Sep 2 '12 at 9:21
+1 For broadening on the answer - thanks. – user256888 Sep 4 '12 at 10:39

I have updated Johannes' solution of a year ago with many improvements. Significantly:

  • Layer groups are now properly handled so that all layers get written.
  • File names are auto-incremented to prevent collisions (this happens when more than one layer has the same name).
  • Performance is increased. The script can save 500 simple layers in a few minutes.

Besides this, the code has been cleaned up. For example, global variables have been integrated into a single array.

Note that the initial popup message will only tell you the number of top level layers. This is to avoid performance degradation. I can't really imagine a case where you don't know anything about the file you are dealing with, so this should not be much of a compromise.

Grab the script here. Thanks to the previous author for leading the way.

share|improve this answer

protected by Community Nov 1 '12 at 5:29

This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.

Not the answer you're looking for? Browse other questions tagged or ask your own question.