Mobile app version of vmapp.org
Login or Join
Heady304

: Export an image from Illustrator with multiple sizes at once? In addition to this question - How can I export an image from Illustrator image at multiple sizes? Is there a way I can do this

@Heady304

Posted in: #AdobeIllustrator #Automation #Export #MultipleSizes

In addition to this question - How can I export an image from Illustrator image at multiple sizes?

Is there a way I can do this at once? I wish to define few different sizes and export couple of images with one click of a button. Can I even create image size presets? As far as I can see there is only such option for output file format but i don't need to touch it...

More precisely my case is:

I have document with bunch of icons on different layers.
I want to export each icon with those few different sizes to use it in my android app. Right now, each time I want to export an icon i have to


Open "Save for web..."
Select "Image Size" tab
Type size.
Hit "Apply".
Click "Save".
Change file name.
Hit "Save".
Jump to step 3 (times number of sizes).
"Done".
Choose next layer.
Jump to step 1.


Is there any good solution to avoid this nightmare?

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Heady304

3 Comments

Sorted by latest first Latest Oldest Best

 

@Heady304

Sorry I forgot I posted here.
batch-export is better but i still can't record all actions i wish.
Involving Photoshop here is another overkill.

I found the best way to export it with this simple script:

/**
* Remixer: @herkulano (http://www.herkulano.com)
* Thanks to: Niels Bosma (niels.bosma@motorola.com)
*/

var folder = Folder.selectDialog();
var document = app.activeDocument;

if (document && folder) {
$.writeln(document.width);
saveToRes (16, "ldpi");
saveToRes(32, "mdpi");
saveToRes(64, "hdpi");
saveToRes(128, "xhdpi");
//saveToRes(300, "xxhdpi");
//saveToRes(400, "xxxhdpi");
}

function saveToRes(scaleTo, resFolderName) {


scaleTo = scaleTo/document.width*100.0;
$.writeln(scaleTo);
$.writeln((scaleTo*document.width)/100.0);
//return;

var i, layer,
file, options,
resFolder;

resFolder = new Folder(folder.fsName + "/drawable-" + resFolderName);

if (!resFolder.exists) {
resFolder.create();
}

for (i = document.layers.length - 1; i >= 0; i--) {
layer = document.layers[i];
if (!layer.locked && layer.name.indexOf("!") === -1) {
hideAllLayers();
layer.visible = true;

file = new File(resFolder.fsName+ "/" + layer.name + ".png");
$.writeln(resFolder.fsName);
$.writeln(file.fsName);
$.writeln(layer.name);

options = new ExportOptionsPNG24();
options.antiAliasing = true;
options.transparency = true;
options.artBoardClipping = true;
options.verticalScale = scaleTo;
options.horizontalScale = scaleTo;

document.exportFile(file, ExportType.PNG24, options);
}
}
}

function hideAllLayers() {
var i, layer;

for (i = document.layers.length - 1; i >= 0; i--) {
layer = document.layers[i];
if (!layer.locked && layer.name.indexOf("!") === -1) {
layer.visible = false;
}
}
}


I've found it somewhere and just modified sizes to define them in pixels.
Simply create text file, paste this code, save as .jsx and place the file in illustrator's "scripts" folder.
Then run it throught File>Scripts>...

It will do all the job i mentioned in a single action, setting files names from layers names and place them to appropriate folders. You can exclude certain layers by hiding and locking them.

10% popularity Vote Up Vote Down


 

@Shelley591

I like to place the source file in a Photoshop file multiple times as a linked smart object and scale it to the resolutions needed (sort of like a sprite sheet). Then you can create slices for each instance. Saving for web will then give you a folder with the icon in all the different resolutions. You can even set the file names of the export files by naming the slices. If you change your source file, you just need to refresh the linked smart objects in Photoshop and save for web.

10% popularity Vote Up Vote Down


 

@Marchetta832

You can batch-export your icons using the Export dialogue. And additionally you can set the resolution there. So if you are using multiple sizes (like x2, x4) you can simply re-export with different resolution.

If you need smaller sizes from your source icons I would suggest a photoshop action to duplicate and resize the iconset.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme