1
iOS 아이콘을 온라인으로 생성하기 위해이 스크립트를 발견했으며이를 편집하여 파일 열기 도구 대신에 현재 열어 놓은 파일에서 작동하도록했습니다. 필자는 아이콘 구성 프로세스의 속도를 높이기 위해 Adobe Configurator 4를 사용하여 도구를 만들고 있습니다.Adobe Photoshop 스크립트 변경
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 = true;
doc.info = null; // delete metadata
var icons = [
{"name": "[email protected]", "size":1024},
{"name": "iTunesArtwork", "size":512},
{"name": "Icon", "size":57},
{"name": "[email protected]", "size":114},
{"name": "Icon-72", "size":72},
{"name": "[email protected]", "size":144},
{"name": "Icon-Small", "size":29},
{"name": "[email protected]", "size":58},
{"name": "Icon-Small-50", "size":50},
{"name": "[email protected]", "size":100}
];
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 == "[email protected]") || (icon.name == "iTunesArtwork"))
{
// iTunesArtwork files don't have an extension
destFileName = icon.name;
}
doc.exportDocument(new File(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
}
멋진 대답! 감사합니다! –