An Adobe Illustrator script for easily exporting your artboards to iOS images assets with the correct directory structure and resolutions.
Both app icons and standard images can be exported easily. App icons are exported in the resolutions required by Apple for iPhone, iPad, Spotlight icon, etc. Normal images are exported with a scale factor (1x, 2x, 3x).
- Import the script into Adobe Illustrator (to make the script appear under the scripts menu). To import the script save both
export_assets_for_iOS.jsx
andjson2.js
scripts into the/Adobe Illustrator CC 2017/Presets/{localization}/Scripts/
folder. Restart Adobe Illustrator for the changes to have effect! - Open the Illustrator file that includes the artboards you want to export.
- Select the script from the scripts menu:
File > Scripts
- Choose the directory where the images should be exported to. This script is designed to fully integrate with the Xcode IDE, so the correct directory would be
Images.xcassets
folder in your Xcode project. - Choose which artboards you want to export as app icons and which as image assets.
For example, if we choose to export the Artboard AppIcon
as an application icon and the Artboard settings
as image the script will create following resources in following directory structure (with export options displayed as above):
Images.xcassets
├── AppIcon.appiconset
│ ├── AppIcon-20.png
│ ├── AppIcon-20@2x.png
│ ├── AppIcon-20@3x.png
│ ├── AppIcon-29@2x.png
│ ├── AppIcon-29@3x.png
│ ├── AppIcon-40.png
│ ├── AppIcon-40@2x.png
│ ├── AppIcon-60@2x.png
│ ├── AppIcon-60@3x.png
│ ├── AppIcon-76.png
│ ├── AppIcon-76@2x.png
│ ├── AppIcon-Artwork.png
│ ├── AppIcon-Small-40@2x.png
│ ├── AppIcon-Small-40@3x.png
│ ├── AppIcon-iPad-20@2x.png
│ ├── AppIcon-iPad-29.png
│ ├── AppIcon-iPad-29@2x.png
│ ├── AppIcon-iPad-835@2x.png
│ └── Contents.json
|── settings.imageset
│ ├── settings.png
│ ├── settings@2x.png
│ ├── settings@3x.png
│ └── Contents.json
- The script supports both image sets and app icons.
- For images the corresponding
imageName.imageset
folder is created. For app icons the correspondingappIconName.appiconset
folder is created. - In each folder the
Contents.json
file is created that describes the resources. This way the resources are correctly displayed in Xcode.
This repository is under the MIT license, have a look at the LICENSE
file.