如何缩放不同大小的 iOS 应用程序图标

Dan*_*ner 6 icons app-store ios

应用程序图标的每次更改都需要为 Xcode 生成合适的图标大小。我一直在寻找一种有效的方法来生成这些图标。

很明显,自动化过程不会关心像素拟合或类似细节。但是对于我们大多数人来说,一个简单的 AppleScript 应该可以解决问题。

以下屏幕显示了所需的所有尺寸:

在此处输入图片说明

我收集了不同的资源并制作了一个简单的工作脚本供大家分享......所以你去 - 只需在下面查看我的答案

Dan*_*ner 5

这里有一个简单的 AppleScript 供你们所有人使用……您可以随意改编和使用它:

on run
    set f to choose file
    processTheFiles({f})
end run

on open theFiles
    processTheFiles(theFiles)
end open

on processTheFiles(theFiles)
    tell application "Image Events" to launch
    repeat with f in theFiles
        set thisFile to f as text

        -- iPhone       
        scaleAndSave(f, thisFile, 29 * 1, "-iPhone-29")
        scaleAndSave(f, thisFile, 29 * 2, "-iPhone-29@2x")
        scaleAndSave(f, thisFile, 40 * 2, "-iPhone-40@2x")
        scaleAndSave(f, thisFile, 57 * 1, "-iPhone-57")
        scaleAndSave(f, thisFile, 57 * 2, "-iPhone-57@2x")
        scaleAndSave(f, thisFile, 60 * 2, "-iPhone-60@2x")

        -- iPad
        scaleAndSave(f, thisFile, 29 * 1, "-iPad-29")
        scaleAndSave(f, thisFile, 29 * 2, "-iPad-29@2x")
        scaleAndSave(f, thisFile, 40 * 1, "-iPad-40")
        scaleAndSave(f, thisFile, 40 * 2, "-iPad-40@2x")
        scaleAndSave(f, thisFile, 50 * 1, "-iPad-50")
        scaleAndSave(f, thisFile, 50 * 2, "-iPad-50@2x")
        scaleAndSave(f, thisFile, 72 * 1, "-iPad-72")
        scaleAndSave(f, thisFile, 72 * 2, "-iPad-72@2x")
        scaleAndSave(f, thisFile, 76 * 1, "-iPad-76")
        scaleAndSave(f, thisFile, 76 * 2, "-iPad-76@2x")

    end repeat
    tell application "Image Events" to quit
end processTheFiles

on scaleAndSave(aPath, aFile, aSize, aName)
    set savePath to text 1 thru -5 of aFile & aName & text -4 thru -1 of aFile
    tell application "Image Events"
        set a to open aPath
        scale a to size aSize
        save a in savePath
    end tell
    delay 0.2
end scaleAndSave
Run Code Online (Sandbox Code Playgroud)

这里和文件一样......只需下载,保存,双击并运行:https : //dl.dropboxusercontent.com/u/170740/AppIcon.applescript

我希望,这可以为您节省一些时间...