Mobile app version of vmapp.org
Login or Join
Chiappetta793

: Is there a way to batch export Illustrator symbols as pngs? I use Illustrator as my main graphics program for building modular UI components. Context: I'm exploring an animation software, Pixate,

@Chiappetta793

Posted in: #AdobeIllustrator #Symbols

I use Illustrator as my main graphics program for building modular UI components.



Context: I'm exploring an animation software, Pixate, and will need to upload all UI assets to the project library — is there any way to make this any easier by somehow batch exporting all the symbols in a Symbol Library?

I have not yet been able to find a solution online that solves this, and would appreciate any direction!

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Chiappetta793

1 Comments

Sorted by latest first Latest Oldest Best

 

@Debbie163

The following script will export all your symbols from the symbol library and save them to a chosen folder.

You just have to make sure all your layers are hidden first.

var doc = app.activeDocument;
var symbolCount = doc.symbols.length;

if (symbolCount >= 1) {

if (confirm("Are all your layers hidden?")) {

// create temp layer
doc.layers.add();

// create directory
var dest = Folder.selectDialog();
dest.create();

// loop through symbols
for (var i = 0; i < doc.symbols.length; i++) {

// place a symbol instance - temp
var s = doc.symbolItems.add(doc.symbols[i]);

// assign name
var filename = (doc.symbols[i].name)

// export symbols
savePNG(dest, filename);

// delete temp symbol instance
s.remove();
}
// remove temp layer
doc.layers[0].remove();
}

function savePNG(dest, filename) {
// save options
var type = ExportType.PNG24;
var options = new ExportOptionsPNG24();
options.transparency = true;

// file
var file = new File(dest + "/" + filename);

// export
doc.exportFile(file, type, options);
}

} else {
alert("You don't have any symbols in this document");
}


You can find this script at: gist.github.com/shaneparsons/1717f21a757f24fb4559

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme