If you’ve read my previous article about how to perform batch actions in Illustrator, you might also be wondering if this technique can be used to export Illustrator files to JPG or PNG. Well, it can. And it’s simple. In this article I’ll show you how to do this.
Batch export Illustrator files to JPG
If you’re interested in the background story on how AppleScript can be used to create a macro for any given program, or how a batch in Illustrator can be done, read my previous articles.
If you just want to batch export Illustrator files to JPG, you can use the following AppleScript:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
on run # Set the files: tell application "Finder" set theFiles to files of folder POSIX file "/Users/Giel/Desktop/my illustrator files" as alias list end tell # Set an iteration for the new filenames: set i to 1 repeat with f in theFiles # Set the destionation path: set pathString to "/Users/Giel/Desktop/exported/file-" & i & ".jpg" # Open the file in Illustrator: tell application "Adobe Illustrator" activate open f # Export the file to JPEG: export current document to file pathString as JPEG with options {class:JPEG export options, artboard clipping:true, quality:80, horizontal scaling:100, vertical scaling:100} # Close the document without saving: close current document saving no end tell set i to i + 1 end repeat end run |
There are some parameters here you can tweak, like the quality of the JPEG or if you would like to perform additional scaling.
Batch export Illustrator files to PNG
It’s also possible to export as a PNG image by changing the export rule to something like:
1 2 |
# Export the file to PNG: export current document to file pathString as PNG24 with options {class:PNG24 export options, horizontal scaling:50.0, vertical scaling:50.0, saving as HTML:false} |
Of course you are free to do as much as you want. You could for example create a JPEG thumbnail, PNG for web and a large JPEG all in one batch. The possibilities are endless!
Visitors give this article an average rating of 3.0 out of 5.
How would you rate this article?
★ ★ ★ ★ ★
HI, for some reason this script (PNG) isn’t working for me with CC2015—have you had any problems with the CC update? The error I’m getting is : error “Adobe Illustrator got an error: Folder some object wasn’t found.” number -120
I’m not a developer so I apologize for my lack of intuition on fixing this. Thanks so much for your help!
Apologies for the late reply, but if you’re struggling with the AppleScript side then you might want to check out Automator and some third-party actions. Much easier to do drag and drop than to write code. Check out:
https://www.ghostotter.com/batch-converting-adobe-illustrator-files-eps-files/
…in the interests of transparency, I’m the developer of the above.
Good luck!