Skip to content

Instantly share code, notes, and snippets.

@tehmou
Created January 9, 2013 09:53
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tehmou/4492002 to your computer and use it in GitHub Desktop.
Save tehmou/4492002 to your computer and use it in GitHub Desktop.
Script for Adobe Illustrator that rasterizes all layers and groups the name of which starts with "rasterize". To run save as .jsx and open from File/Scripts/Other Script... or run with ExtendScript Toolkit.
var rasterizeOptions = new RasterizeOptions();
rasterizeOptions.transparency = true;
function process (item) {
$.writeln(item.name);
if (/^rasterize/.exec(item.name)) {
app.activeDocument.rasterize(item, null, rasterizeOptions);
} else {
if (item.layers) {
for (var i = 0; i < item.layers.length; i++) {
process(item.layers[i]);
}
}
if (item.groupItems) {
for (var i = 0; i < item.groupItems.length; i++) {
process(item.groupItems[i]);
}
}
}
}
process(app.activeDocument);
@avillarubia
Copy link

thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment