Back to Blog
Development15 min read

Building an Automated Icon Generation Workflow

Streamline your development process with automated icon generation. Learn about CI/CD integration, batch processing, and maintaining consistency across platforms.

Naresh Bhosale
December 28, 2023

Building an Automated Icon Generation Workflow

In modern mobile development, efficiency is key.Manually resizing and exporting dozens of icon assets for iOS and Android is tedious and error - prone.By automating this workflow, you can save time and ensure perfect consistency across every build.

Why Automate ?

- Consistency : Eliminate human error.Ensure every icon size is generated from the same source file every time.
- Speed: Generate hundreds of assets in seconds instead of hours.
- Version Control: Track a single source file(e.g., `icon.svg`) instead of committing hundreds of binary images to your repo.

The Workflow

A typical automated icon workflow involves three main steps:

1. Source Management: Keeping a high - resolution master file.
2. Generation Script: A tool to process the master file into platform - specific assets.
3. Integration: Hooking this process into your build system.

1. Source Management

Keep your master icon as a vector file(SVG) or a high - resolution PNG(1024x1024px).Store this in a dedicated `assets/source` directory.

2. Using Tools like Expo CLI

If you are using Expo, automation is built-in.

```json
// app.json
{
"expo": {
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png"
}
}
}
```

With this configuration, Expo(specifically EAS Build or `npx expo prebuild`) automatically generates the native android and ios folders with all the correct icon densities.

3. CI/CD Integration

For teams using Continuous Integration (CI), you can ensure icons are fresh on every build.

Example GitHub Actions Step:

```yaml
- name: Install dependencies
run: npm install

- name: Generate Native Assets
run: npx expo prebuild--platform all--no - install
```

This command ensures that whatever is in your `app.json` is faithfully reproduced in the native projects before compilation.

Advanced: ImageMagick & Custom Scripts

For non-Expo projects or custom needs, you might use ImageMagick. A simple shell script can generate all sizes:

```bash
#!/bin/bash

Generate iOS Icons
convert icon.png - resize 20x20 ios / AppIcon.appiconset / Icon - 20.png
convert icon.png - resize 40x40 ios / AppIcon.appiconset / Icon - 40.png

...and so on
```

Maintaining Consistency

- Lock Source Files: Only the lead designer or designated developer should update the source `icon.png`.
- Review Changes: Treat icon updates like code changes. Review them in Pull Requests.
- Automated Validation: Use tools to verify that your `app.json` points to valid existing files before building.

Conclusion

Automating your icon generation workflow allows you to focus on building features rather than resizing images. Whether using Expo's built-in tools or custom scripts, the investment in setup pays off in long-term stability and speed.

Tags

automationci-cdworkflowproductivity

Ready to Generate Perfect Icons?

Put these techniques into practice with our automated icon generation tool. Create platform-specific icons from a single source image in seconds.

Try Icon Generator