Icon sizes are used by the system, not by AppleScript, so whatever conventions the system wants for 'regular' app should be used for an AppleScript app as well.
EDIT
Per the comments on one of the other answers, here's a script that will create an icns file with all suggested sizes from whatever image you choose:
set picFile to choose file with prompt "Choose an image to iconize." of type {"public.image"}
set workingFolder to POSIX path of (path to temporary items from user domain)
set outputFolder to POSIX path of (path to desktop from user domain)
set sizesList to {16, 32, 128, 256, 512}
tell application "System Events"
set pictureFilePath to quoted form of (get POSIX path of picFile)
set {pictureName, ext} to {name, name extension} of picFile
if ext is not "" then
set pictureName to text 1 through -((length of ext) + 2) of pictureName
end if
-- create iconset folder
set iconsetFolder to make new folder at folder workingFolder with properties {name:pictureName & ".iconset"}
-- cycle through sizes to create normal and hi-def sized icon images
repeat with thisSize in sizesList
set iconFilePath to POSIX path of iconsetFolder & "/" & my makeFileNameFromSize(thisSize, false)
do shell script "sips -z " & thisSize & " " & thisSize & " " & "-s format png " & pictureFilePath & " --out " & iconFilePath
set iconFilePath to POSIX path of iconsetFolder & "/" & my makeFileNameFromSize(thisSize, true)
do shell script "sips -z " & thisSize * 2 & " " & thisSize * 2 & " " & "-s format png " & pictureFilePath & " --out " & iconFilePath
end repeat
-- create new icns file
set iconsetPath to quoted form of (POSIX path of iconsetFolder as text)
set outputPath to quoted form of (outputFolder & pictureName & ".icns")
do shell script "iconutil -c icns -o " & outputPath & " " & iconsetPath
end tell
on makeFileNameFromSize(s, x2)
set fileName to "icon_" & s & "x" & s
if x2 then set fileName to fileName & "@2x"
set fileName to fileName & ".png"
return fileName
end makeFileNameFromSize
Caveats:
- This puts the icns file on the desktop; that can be changed by changing the
outputFolder
variable.
- This can throw an error if there are characters in the image file name that the shell interprets as meaningful. I noticed this on a filename that contained parentheses, but didn't add any error checking.
- This script does not preserve aspect ratios, so if you feed it an image that's not square it will produce distortions. If you want to preserve aspect rations, keep in mind that icons have to be square, so you'll have to square the image by cropping or padding first.