โ ๏ธ This will be deprecated since Xcode 14 allows a single 1024x1024 icon asset which gets scaled automatically.
This script allows you to create iOS App Icon Assets which can be dragged directly into Xcode.
Additionally you can remove the alpha channel of every PNG in a specific directory.
This is especially useful for iOS App Icon Assets which require the alpha channel to be removed in order to be accepted by App Store Connect. Many applications like Figma export PNGs with alpha channel by default with no easy way to disable it.
The workaround would be to open each exported PNG in Preview and export it again with the "Alpha Channel" option unchecked.
To install this script permanently just put it in your /usr/local/bin/
directory.
$ sudo cp icon-asset-util /usr/local/bin/icon-asset-util
Now it can be used globally just by calling
$ icon-asset-util [options]
You can also put it wherever you want and use it like this:
$ path-to-script/icon-asset-util [options]
To create an Asset Catalog simply put any input PNG in a convenient location and from there call
$ icon-asset-util -a your-icon.png
This will create an 'AppIcon.appiconset' folder with all the required sizes inside. It also creates a 'Content.json' file so you can just drag the whole folder into your Xcode projects Assets Catalog.
If you already have your icons in all the required sizes, but you encounter an error when uploading to App Store Connect, that the App Icon must not have an alpha channel, navigate to your asset folder inside your Xcode project and run the following command
$ icon-asset-util -r .
Or provide the path to the asset folder as an argument
$ icon-asset-util -r path-to-directory
- Important: Script was renamed to
icon-asset-util
- Important: Syntax changed (see current Syntax above)
- Create App Icon Sets
- Ommitted
.sh
file extension
- Show status when converting
- Display success message on completion
- Remove the alpha channel of all PNGs in a folder