Tag Archives: icon

photoshop script for producing logo files for adobe AIR apps

While knocking up a simple little adobe AIR application I saw that there are many available icon sizes that can be used. Being a lazy programmer I thought I’d script this up rather than wading through photoshop. It’s pretty easily customizable if you want to change the sizes

This code goes in a .jsx file and run on the currently open document in photshop by going to: File -> Scripts -> Browse

var curDoc = app.activeDocument;

saveAsIconSize(512);
saveAsIconSize(128);
saveAsIconSize(72);
saveAsIconSize(57);
saveAsIconSize(48);
saveAsIconSize(36);
saveAsIconSize(32);
saveAsIconSize(29);
saveAsIconSize(16);

function saveAsIconSize(size) {
    
    curDoc.resizeImage(UnitValue(size,"px"), UnitValue(size,"px"), null, ResampleMethod.BILINEAR);
    
    // our web export options
    var options = new ExportOptionsSaveForWeb();
    options.quality = 100;
    options.format = SaveDocumentType.PNG;
    options.transparency = true;
    options.interlaced = false;
    options.optimized = true;
    options.PNG8 = false;
    
    var newName = 'icon-'+size+'x'+size+'.png';

    curDoc.exportDocument(File(curDoc.path+'/'+newName),ExportType.SAVEFORWEB,options);     
    
}