Skip to content

Instantly share code, notes, and snippets.

@Benitoite
Forked from jamieweavis/macos-app-icon.md
Created September 10, 2023 04:19
Show Gist options
  • Save Benitoite/90ec6528062df2a4ae744c4749203eb5 to your computer and use it in GitHub Desktop.
Save Benitoite/90ec6528062df2a4ae744c4749203eb5 to your computer and use it in GitHub Desktop.
How to create an .icns macOS app icon

How to create an .icns macOS app icon

How to make an application icon for macOS using iconset & iconutil

Steps

Saving images

Save your app icon with the following names & dimensions:

Name Dimensions
icon_16x16.png 16x16
icon_16x16@2x.png 32x32
icon_32x32.png 32x32
icon_32x32@2x.png 64x64
icon_128x128.png 128x128
icon_128x128@2x.png 256x256
icon_256x256.png 256x256
icon_256x256@2x.png 512x512
icon_512x512.png 512x512
icon_512x512@2x.png 1024x1024

Creating an .iconset

  1. Move all of the images into a new folder
  2. Rename the folder to: icon.iconset
  3. Confirm the file extension when prompted

This will convert the folder of images into an iconset, this can be verified by quick looking with the spacebar - a resizable preview of your icon should now appear.

Converting to .icns

  1. Navigate to the directory containing your icon.iconset in the terminal
  2. Run iconutil with the following command: iconutil -c icns icon.iconset
  3. Your icon.icns will be generated in the current directory
@Benitoite
Copy link
Author

Benitoite commented Sep 10, 2023

Image-to-icns AppleScript droplet

on open the_files
	repeat with i from 1 to the count of the_files
		tell application "Finder"
			set myFileName to POSIX path of item i of the_files
			set exten to name extension of item i of the_files
		end tell
		set orig_path to POSIX path of (((path to me as text) & "::") as alias) as string
		set my_path to orig_path & "icon.iconset"
		do shell script "mkdir " & my_path
		do shell script "sips -z 1024 1024 " & myFileName & " -s format png --out " & my_path & "/icon_512x512@2x.png"
		do shell script "sips -z 512 512 " & myFileName & " -s format png --out " & my_path & "/icon_512x512.png"
		do shell script "sips -z 512 512 " & myFileName & " -s format png --out " & my_path & "/icon_256x256@2x.png"
		do shell script "sips -z 256 256 " & myFileName & " -s format png --out " & my_path & "/icon_256x256.png"
		do shell script "sips -z 256 256 " & myFileName & " -s format png --out " & my_path & "/icon_128x128@2x.png"
		do shell script "sips -z 128 128 " & myFileName & " -s format png --out " & my_path & "/icon_128x128.png"
		do shell script "sips -z 64 64 " & myFileName & " -s format png --out " & my_path & "/icon_32x32@2x.png"
		do shell script "sips -z 32 32 " & myFileName & " -s format png --out " & my_path & "/icon_32x32.png"
		do shell script "sips -z 32 32 " & myFileName & " -s format png --out " & my_path & "/icon_16x16@2x.png"
		do shell script "sips -z 16 16 " & myFileName & " -s format png --out " & my_path & "/icon_16x16.png"
		do shell script "iconutil -c icns " & my_path
		do shell script "mv " & orig_path & "/icon.icns " & orig_path & "/$(basename " & myFileName & " ." & exten & ").icns"
		do shell script "rm -r " & my_path
	end repeat
end open

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment