Update: I’ve got a much improved version of the script that also exports artboards and adds a PDFs option. Get the improved version.
Hot on the heels of my Illustrator script to export artboards as PNG files, here’s one that exports Illustrator layers as PNG files.
To use the script, download Export-Layers-as-PNG.jsx and put in your Illustrator scripts folder (usually in Applications/Adobe Illustrator/Presets/Scripts/). Restart Illustrator, and run the script by going to “File > Scripts > Export Layers as PNG”.
- Files are named based on their layer name. It only exports layers where their name has been changed from the default “Layer 1″, “Layer 2″, etc.
- If you put a plus sign (+) in front of a layer name, that layer will always be visible. Useful for if you want to have a layer that always appears in the background of each exported image.
- If you put a minus sign (-) in front of a layer name, it will skip that layer.
- It stores its settings in a nonvisible, nonprinting layer named “nyt_png_info”
- It has an option for transparency, and lets you choose between PNG8 and PNG24.
You can try it out on the sample file layer-test.ai.


When you run this script on this file, it will export 2 PNGs: Play.png and Pause.png. The “+Button” and “+Gradient” layers will appear in the background of both exported files, and it will skip the “-Pause 2″ and “Layer 5″ layers.

[...] scripts that export multiple artboards in an Illustrator document as PNG files, and exports multiple layers as PNG files. (See my previous blog posts here and here.) I’d been meaning to merge them into one script, [...]
This is an amazing time-saver!
..Although i’m wondering if you could suggest something even better for my situation.
The challenge i’m facing is exporting bunches of same-sized symbol instances (like, zillion on daily basis). Think of it as tiles with repeating elements (other symbol instances), and with some minor change in those elements i need to re-save all the containers.. a nightmare!
I can place them easily on the artboard, but your script works on layers, not objects in the layer. Putting symbols on different layers (i can use Release to Layers option) would require renaming those layers to math object names manually (or am i missing some AI features here?), or your script will skip it since they are named in default “Layer 1″ style.
So far the best solution is to do some manual moving/renaming before using your script, but just wanted to check if there’s quicker solution (zillion, remember!).
Looking forward on your thought and thanks again for wonderful script!