I know, I know... It's been a while. Hopefully this will make up for some of the lonely feelings you've had to suffer through.
Behold my newest creation: exportLayers.jsx
It will export as many images as you have layers in an .ai document.
And provides the option for you to process multiple open documents or just the current active document.
You can batch export images like this as PNG, JPG, or GIF with a single click:
just by creating a layer structure like this:
Make sure your static layers are locked.
All unlocked layers will be exported, regardless of visibility.
Layers that are both locked AND hidden will be ignored completely.
....and if that weren't cool enough...
The script also auto-generates a production script into your chosen images export directory, so if you ever need to re-run the batch, just re-open all the same source files, double click the .jsx file in your image export directory, and it will skip the dialog and re-export all the images with the same settings.
Happy Illustrating,
-J
61 comments:
You genius ! It make years I'm searching this ! Thanks a lot.
Fantastic script, very useful love it! Illustrator should have this out of the box.
This seems to work on CS4, not on CS3. Maybe just my PC.
What a coincident, I was actually looking for something like this just few days ago.
By the way, is there anyway you could make the script to export out objects, based on the bounding size of the elements per layer? I meant, so that it crops perfectly.
Illustrator has this famous glitch of exporting out with 1 px shift, so that needs to be considered. Normally if you manually set the crop, that should be fine. But Save For Web, tends to give you extra or less 1 px. For example object with 80x80 size becomes 79x81, weird.
Love all your script btw. Thanks a lot :)
Yeah, this script is very beta right now. I've tested it only on Windows7 with AI5. I'm glad to hear it works on CS4 as well. :)
I'm quite familiar with the frustration of the export-for-web, "give or take a pixel or so" problem.
I'm not sure if I can duplicate the functionality of export-for-web in a script, but lets talk more about what this would look like. I'm intrigued.
-J
I just tested your script and its pretty neat (snow leopard 10.6.4 CS5 ), the only problem is when i export to png format the resolution of the image that comes out from running the script is really bad.
Any clue?
thanks
Hey thanks for taking the time to comment BeastBrothers! I'm am thrilled to hear this runs on at least one flavor of Mac OS. :)
Honestly, I'm not sure why the PNG output would be low-res. Can you email me your .ai and a sample of your exported PNG, and I'll see if I can duplicate the problem on my end.
I don't see any obvious resolution settings for png24 export settings, and the 'a','b','c' graphics in the post above were generated using the stock PNG export settings in my script.
I have been searching for this for such a long time! No other script has allowed for static layers. This is going to save me so much time every day. Thank you so much.
Tested with Adobe CS3 and Mac OS X 10.6.2
I'm using Mac Os 10.6, Illustrator CS5.
When I run the script it only puts the jsx file, nuthing else, and aftre effects automatically opens saying it doesnt recognise the script.
Any idea to this weird problem?
Wow, Cagri, that's new to me. You might try running the script from Adobe's Javascript Toolkit with the target set explicitly to Illustrator.
Please email me if this doesn't work, and we can troubleshoot further.
thanks for the report.
-J
This is EXACTLY what I need!
...for Photoshop.
I'd like to export all the layers as individual files while copying a white background and a brightness correction layer for all of them.
Could this script work for photoshop? Where could I get a similar script for photoshop?
I'll get there. BUT meanwhile you're in luck. If you're in a pinch, you CAN open/import your PSD files into illustrator. Just make sure include hidden layers is checked.
cheers,
-J
Hi.
Thanks this is exactly what I needed. I work on OS X 10.6 and the script works perfectly.
lg.ph
Wow... if this was out 6 months ago, it would have literally sved me dozens and dozens of hours of work. I've been looking for a script that did this for ages, but nothing worked exactly how I needed. I just searched again, and found this- I tested it and it works perfectly. Exporting locked layers is the key. I would have payed $$ for this- Thanks again! It's going to save me a couple hrs today, and much more in the future.
Thank you so much! Great!
works great! thanks so much!
OMG you're awsomeeee Thnks thnks thnks
Hi John,
Your script looks great !
Do you also know how to do a similar batch export, but then to SWF in stead of an image file?
For a certain application I need every shape i created as an individual swf file.
Thanks.
P.s. I'm using AI CS3
Hey John,
I found it already... Appeared to be a standard option in CS3. It was only 'hidden'.
By clicking the Advances/Basic button in the SWF-Save dialog you can select "AI Layers to SWF Files".
By the way... strange that script that you wrote isn't part of the standard export options, just like with the SWF export.
hello. i modified your script in order to make it recursive, so that it could handle overlapping layers for the purpose of animation.
here is the modified script:
https://gist.github.com/874413
Hey John,
This is great. I would like to use your script "Export Layers as Images".
It does all that I want to be done.
But I would like to use this to export to SWF and SVG. Is there any script that does the Job or is it possible to adjust this one so is does the job? I work with files which contains between 100 and 200 layers and now I save every layer as a singe image by hand. I'm going crazy.
I am amazed about the things you do with scripting. Keep up the good work and thanx for sharing!
Marc
Hey Marc,
Thanks for posting. Wow, manually exporting 200 layers sounds like a nightmare.
I suggest that you run the exportLayers script with the "copy production script to target folder" option, then it will make a special purpose script in that folder that will use the settings you chose. While I do not currently have support for svg or swf, there IS a ExportDocsAsFlash.jsx and ExportDocsAsSVG.jsx script that ships with illustrator that you could probably use to reverse engineer the production script for the job. I do plan to offer such a script soon, but if you're in a production crunch, I think this will be the fastest road to success.
Let me know if you get stuck. I'll be happy to provide pointers.
cheers,
-J
Also Marc,
Check out Arjan's post a few comments above. He seems to have found a built in solution in CS3's export swf dialog.
cheers,
-J
same issue on osx 10.6 with it just putting a javascript file in the chosen folder and opening it in AE. Great idea though!
Hey proxemics,
I'm not sure what you're trying to achieve but if you want me to help troubleshoot this, email me directly.
My address is in the head of all my scripts.
cheers,
-J
I don't know what I'm doing wrong, but it doesn't work for me at all. I'm using CS5 on Vista. When I run the script, nothing happens. The ExportPNG.jsx file is generated, but no images are saved AT ALL. What am I leaving out?
Be sure you have layers visible. I'd say try goofing with your layer lock and visibility settings. They need to be root layers, not sub-layers. If you still have problems email me direct at the email in the script header and we can troubleshoot from there.
cheers,
-J
I am so jealous of the folks who this works for. I really love the idea. But I (like a comment above) have the problem that After Effects launches and tells me it's not a supported filetype.
When I open the script in ExtendScript Toolkit and run it, it jumps over to Illustrator to present me the dialog (your dialog), then once I say "do it" it launches After Effects.
Any thoughts on what steps I can take to test this and send you logs or something?
Hey bladnman,
Pop me an email (address is on top of all my scripts)
Let's troubleshoot. First let me know your OS and version of Illustrator.
I'll post any workaround we find here.
thanks,
-J
The problem is that .jsx extensions are assigned to After Effects. I think this problem only occurs on Macs. I'm unable to test it, but changing the program association to AI should fix it. Try this link that explains how to reassign and let me know if this is a solution.
http://www.fileinfo.com/help/mac_change_program
cheers,
-J
Thanks just saved me a lot of time :)
Nice one!! Works with mac and Ai 5.1 :)
thank you SO much - this has saved me hours of work!
NICE!
I'm making audio controller files for DPS and this is PERFECT
great work, can't seem to get past the After Effects issue. On a MAC it wont let you associate this file with AI. Anyone able to fix this?
Hey proxemics,
Your copy of Illustrator should have also shipped with the "Adobe ExtendScript Toolkit" it's a javascript development environment for working with Adobe scripts. You might try launching the script from there. You can explicitly assign the target to AI in the drop-down (on the upper left)
If that fails, then what is happening is that the script runs correctly, but when it tries to run the production script, it launches AE. If that is the case, then you can open the auto-generated production script in the ExtendScript Toolkit, and run it from there. It's an extra step, but it should get you running.
-J
thanks john! it works with the extra step of running the auto-generated script. Weird it wont work even from extend script, when i try that it says:
Cannot execute script in target engine 'estoolkit'!
(#57) Engine 'estoolkit' does not exists!
Anyways, great script ans support though! If I knew more about AI scripting I would try and fix it on OSX.
Hey proxemics,
Glad to hear you got it working!
Be sure when you run the script in the estoolkit, that the drop-down on the upper left has "illustrator" selected.
cheers,-J
Hi
We need a script which can iterate through multiple artboards.Has anyone created one.
Best Regards
Amit
Not that I've seen, although, such a project should be fairly simple for any experienced javascript coder.
Great. But whould be greater if there is possibility to control DPI (now is 72, i need 300)
Thanks
Sadly, I've checked the spec for export options, and there is no control for export resolution. It's a great idea, I'll run some experiments and see if I can trick it into working.
it's totally great, but 72 dpi is too small for web images like (jpg, png).
Wait.. What??? Almost all the images on the web are 72dpi.
I just learned that there is indeed a horizontal and vertical scale option for exported jpg files. I haven't checked other formats, but I think it should work the same for the other image types as well. I'll write a full post about it this weekend, with some examples of how to export images at higher resolutions.
Amazing, just what I was looking for. The scaling factor solves all my problems!
Thank you!
This tool saved me so much time, thank you! I got errors when I tried to run it in CS 5.5 but everything worked perfectly when I tried in CS3.
thank you so much
XX
Loved this tool!! It works really well with CS4, thanks a lot!!
hai sir
i wana export multiple .eps files to psd,
say like a 100+
is ths posble with a script?
I'd realy appreciate it . . . . .
Hey Basith,
This is what scripting was made for. I can do this for you. Please email me directly. Me email is at the head of all my scripts.
cheers,
-J
This is brilliant! Many thanks for posting. Any chance you could add the ability to export as SVG? If you did, you would be safe in the knowledge that you've made the world a better place for me and my colleagues!
Hey Jeff, once you run your script for the first time, it will create a 'production' script in the output folder. Read through it, and notice that there are a bunch of 'export' functions. You should be able to modify it to use a saveAsSVG function. I believe there is a "save as svg" example in the Javascript Developers Guide. I haven't tried it, but be careful, it may export all your hidden layers as invisible geometry.
@jeff, email me directly if you get stuck...
This is a bunch of awesomeness!! Thanks for creating this script! Saved me a boatload of time! Running 10.6.8 OS with CS4.
Woohooo! Will definitely be checking out the rest of your awesome scripts!
Thank you very much.
This helps a lot exporting stuff that won't work on Toon Boom Animate unless it's made of bitmaps or the effects are remade again.
This script has been so useful I now can't imagine life without it! The problem is I've upgraded to Illustrator CC now and the script automatically opens CS6.
Have you got time to do a CC version? You would make a complete stranger very happy!
Hey Jeff, thanks for the head's up. I didn't know there was a problem with CC.. I don't have a copy, so I can't really test it, but I assume it doesn't like the windowing. Rebuilding this with prompts seems like it would be painful to use. I'll look at what options there are for advanced windowing support in CC, but otherwise I don't see a clean upgrade path. Email me if you want to discuss. cheers,-J
You are the best! i have used your script for a long time, but it was not working in illustrator cs6, but with your comment on changing the asosciated program to extend script toolkit it worked beautiful!
thank you sooo much!
Hey John, i just had a quick question can this script for commercial use? I tried looking for any disclaimer but i couldnt seem to find anything. As in use the scripts in illustrator on commercial graphics, not use the code for software use. Thanks, and thanks heaps for this script its a real timesaver!
Hey Matt, yeah totally cool. Use it however you want. As long as you don't sell the code, it's all good.
Thanks a lot! this really helps! xD
Post a Comment