iOS 应用图标icon


https://github.com/totemtec/documents/blob/master/PhotoShop%20Scripts/Create%20iOS%20Icons.jsx


try
{
// Prompt user to select iTunesArtwork file. Clicking "Cancel" returns null.
var iTunesArtwork = File.openDialog("Select a sqaure PNG file that is at least 1024x1024.","*.png",false);
 
if (iTunesArtwork !== null)
{
var doc = open(iTunesArtwork,OpenDocumentType.PNG);
 
if (doc == null)
{
throw "Something is wrong with the file. Make sure it's a valid PNG file.";
}
 
var startState = doc.activeHistoryState;// save for undo
var initialPrefs = app.preferences.rulerUnits;// will restore at end
app.preferences.rulerUnits=Units.PIXELS;// use pixels
 
if (doc.width!=doc.height)
{
throw "Image is not square";
}
else if ((doc.width<1024) && (doc.height<1024))
{
throw "Image is too small! Image must be at least 1024x1024 pixels.";
}
else if (doc.width<1024)
{
throw "Image width is too small! Image width must be at least 1024 pixels.";
}
else if (doc.height<1024)
{
throw "Image height is too small! Image height must be at least 1024 pixels.";
}
 
// Folder selection dialog
var destFolder = Folder.selectDialog("Choose an output folder");
 
if (destFolder == null)
{
// User canceled, just exit
throw "";
}
 
// Save icons in PNG using Save for Web.
var sfw = new ExportOptionsSaveForWeb();
sfw.format=SaveDocumentType.PNG;
sfw.PNG8=false; // use PNG-24
sfw.transparency=false;
doc.info=null; // delete metadata
 
//References:
//http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/MobileHIG/IconsImages/IconsImages.html%23//apple_ref/doc/uid/TP40006556-CH14-SW2
 
var icons = [
 
//for Ad Hoc Only
{"name":"iTunesArtwork@2x","size":1024},
{"name":"iTunesArtwork","size":512},
 
//for App Icon
{"name":"Icon-60@3x","size":180},//iPhone 6 Plus (@3x)
{"name":"Icon-60@2x","size":120},//iPhone 6 and iPhone 5 (@2x)
{"name":"Icon-76@2x","size":152},//iPad and iPad mini (@2x)
{"name":"Icon-76","size":76},//iPad 2 and iPad mini (@1x)
 
{"name":"Icon","size":57},//iPhone Non-Retina (iOS 6.1 and Prior)
{"name":"Icon@2x","size":114},//iPhone Retina (iOS 6.1 and Prior)
{"name":"Icon-72","size":72},//iPad Non-Retina (iOS 6.1 and Prior)
{"name":"Icon-72@2x","size":144},//iPad Retina (iOS 6.1 and Prior)
 
//for Spotlight search results icon
 
{"name":"Icon-40","size":40},//iPad Non-Retina
{"name":"Icon-40@2x","size":80},//iPad Retina
{"name":"Icon-40@3x","size":120},//iPhone 6 Plus
 
//for Settings icon
 
{"name":"Icon-29","size":29},//iPhone Non-Retina (iOS 6.1 and Prior)
{"name":"Icon-29@2x","size":58},//iPhone Retina (iOS 6.1 and Prior)
{"name":"Icon-29@3x","size":87},//iPhone 6 Plus
 
{"name":"Icon-50","size":50},//iPad Non-Retina (iOS 6.1 and Prior)
{"name":"Icon-50@2x","size":100},//iPad Retina (iOS 6.1 and Prior)
];
 
var icon;
for (i = 0;i< icons.length;i++)
{
icon = icons[i];
doc.resizeImage(icon.size,icon.size,// width, height
null,ResampleMethod.BICUBICSHARPER);
 
var destFileName = icon.name+".png";
 
if ((icon.name=="iTunesArtwork@2x")||(icon.name=="iTunesArtwork"))
{
// iTunesArtwork files don't have an extension
destFileName=icon.name;
}
 
doc.exportDocument(newFile(destFolder+"/" + destFileName),ExportType.SAVEFORWEB,sfw);
doc.activeHistoryState=startState;// undo resize
}
 
alert("iOS Icons created!");
}
}
catch (exception)
{
// Show degbug message and then quit
if ((exception != null) && (exception!=""))
alert(exception);
}
finally
{
if (doc != null)
doc.close(SaveOptions.DONOTSAVECHANGES);
 
app.preferences.rulerUnits=initialPrefs;// restore prefs
}



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值