Saturday, September 23, 2017

#1 2017-02-13 10:46:55 am

Woggledog
Member
Registered: 2012-12-06
Posts: 150

AppleScript to create iOS app icons for Xcode

Didn't find anything so created my own script to create, from an original image, a set of icons for an iOS app that can be used in Xcode

Applescript:

set selectedFolder to (choose folder with prompt "Please choose a folder")
set selectedFolderPosix to POSIX path of selectedFolder

set selectedFile to (choose file with prompt "Please choose a target icon to begin with")
set selectedFilePosix to POSIX path of selectedFile

set resolutions to {{"Icon-Notification@1x.png", 20, 20}, {"Icon-Notification@2x.png", 40, 40}, {"Icon-Notification@3x.png", 60, 60}, {"Icon-Small@1x.png", 29, 29}, {"Icon-Small@2x.png", 58, 58}, {"Icon-Small@3x.png", 87, 87}, {"Icon-Spotlight-40@1x.png", 40, 40}, {"Icon-Spotlight-40@2x.png", 80, 80}, {"Icon-Spotlight-40@3x.png", 120, 120}, {"Icon-60@1x.png", 60, 60}, {"Icon-60@2x.png", 120, 120}, {"Icon-60@3x.png", 180, 180}, {"Icon-76x76@1x.png", 76, 76}, {"Icon-76x76@2.png", 152, 152}, {"Icon-76x76@3x.png", 228, 228}, {"Icon-83.5x83.5@2x.png", 167, 167}}

repeat with IconItem in resolutions
   set filename to item 1 of IconItem
   set newDim to item 2 of IconItem & " " & item 3 of IconItem
   
   do shell script "sips " & quoted form of selectedFilePosix & " --resampleHeightWidth " & newDim & " --out " & quoted form of (selectedFolderPosix & filename)
end repeat

Last edited by Woggledog (2017-02-13 10:47:12 am)


Filed under: applescript, icon, xcode, ios

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)