Illustrator automation script for exporting an icon artboard to all the sizes needed for iOS apps.
var destFolder = null; | |
destFolder = Folder.selectDialog( 'Select the folder where you want to save the exported files.', app.activeDocument.path ); | |
var baseDestName = app.activeDocument.name; | |
if (baseDestName.indexOf('.') < 0) | |
{ | |
//nothing | |
} else { | |
var dot = baseDestName.lastIndexOf('.'); | |
baseDestName = baseDestName.substring(0, dot); | |
} | |
var activeArtboard = app.activeDocument.artboards[app.activeDocument.artboards.getActiveArtboardIndex()]; | |
if (destFolder != null) | |
{ | |
exportFileToPNG24(29,"Icon-Small"); | |
exportFileToPNG24(50,"Icon-Small-50"); | |
exportFileToPNG24(57,"Icon"); | |
exportFileToPNG24(58,"Icon-Small@2x"); | |
exportFileToPNG24(72,"Icon-72"); | |
exportFileToPNG24(114,"Icon@2x"); | |
exportFileToPNG24(512,"iTunesArtwork"); | |
} | |
function exportFileToPNG24(iconSize, name) | |
{ | |
var scale = iconSize / activeArtboard.artboardRect[2] * 100; | |
if ( app.documents.length > 0 ) | |
{ | |
var exportOptions = new ExportOptionsPNG24(); | |
var type = ExportType.PNG24; | |
var fileSpec = new File ("" + destFolder + "/" + name ); | |
exportOptions.verticalScale = scale; | |
exportOptions.horizontalScale = scale; | |
exportOptions.antiAliasing = true; | |
exportOptions.transparency = true; | |
exportOptions.artBoardClipping = true; | |
app.activeDocument.exportFile (fileSpec, type, exportOptions); | |
} | |
} |
This comment has been minimized.
This comment has been minimized.
Dude effing amazing, really get sick of hitting save for web & devices 10x This worked fine for me in CS5 on Mac |
This comment has been minimized.
This comment has been minimized.
AWESOME! Thanks so much! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Hi,
I tried using this on CS5, and it export all the assets at the same size (100%)