A cross-platform CLI tool for generating icons in various formats from a single source image. This tool creates icons for Windows (ICO), macOS (ICNS), Linux (PNG), Android, iOS, and Tauri platforms.
- Multi-platform icon generation: Generates icons for Windows, macOS, Linux, Android, iOS, and Tauri
- Platform-specific directories: Each platform gets its own dedicated subdirectory for easy drag-and-drop
- Multiple formats: ICO, ICNS, and PNG formats with appropriate sizes
- Customizable sizes: Generate custom PNG sizes as needed
- Mobile platform support: Automatically generates Android and iOS app icons
- Tauri support: Dedicated
tauri-desktopfolder for Tauri projects - Background color support: Add background colors for iOS icons
- Development badge support: Add a "DEV" badge overlay to icons for development builds
- Apple Asset Catalog support: Automatic generation of
Contents.jsonfor iOS and macOS - Cross-platform: Runs on Windows, macOS, and Linux
- Install Rust from rustup.rs
- Clone this repository:
git clone <repository-url> cd icon-generator
- Build and install:
cargo install --path .
Check the Releases page for pre-built binaries.
icon-gen input-image.pngThis will generate all icon formats in a directory named icon-generator-input-image/ (based on the source filename).
# Specify output directory
icon-gen input-image.png -o /path/to/output
# Generate only Tauri desktop icons (recommended for Tauri projects)
icon-gen input-image.png --tauri-desktop
# Generate custom PNG sizes only
icon-gen input-image.png -p 16,32,64,128,256
# Generate only desktop platform icons (Windows, macOS, Linux)
icon-gen input-image.png --desktop-only
# Generate only mobile platform icons (Android, iOS)
icon-gen input-image.png --mobile-only
# Set iOS background color
icon-gen input-image.png --ios-color "#FF5733"
# Add development/debug badge to all generated icons
icon-gen input-image.png --dev-mode
# Add development badge with specific bug type
icon-gen input-image.png --dev-mode --dev-bug spider
# Generate icons for specific platforms
icon-gen input-image.png --windows --macos
icon-gen input-image.png --android --ios
icon-gen input-image.png --linux -p 16,32,64,128,256Generate various icons for all major platforms
Usage: icon-gen [OPTIONS] <INPUT>
Arguments:
<INPUT> Path to the source icon (squared PNG file with transparency)
Options:
-o, --output <DIR> Output directory (default: icon-generator-{source-name})
-p, --png <SIZES> Custom PNG icon sizes to generate. When set, only these sizes are generated
--desktop-only Generate only desktop platform icons (Windows, macOS, Linux)
--mobile-only Generate only mobile platform icons (Android, iOS)
--tauri-desktop Generate Tauri desktop icons (tauri-desktop folder with icons for src-tauri/icons)
--windows Generate icons for Windows platform
--macos Generate icons for macOS platform
--linux Generate icons for Linux/Desktop platform
--android Generate icons for Android platform
--ios Generate icons for iOS platform
--ios-color <IOS_COLOR> The background color for iOS icons (CSS color format) [default: #ffffff]
--dev-mode Add a development/debug badge to all generated icons
--dev-bug <BUG> Bug type to use for dev badge (cockroach, ladybug, moth, spider, caterpillar) - only effective with --dev-mode [default: moth]
-h, --help Print help
- Directory:
windows/ - File:
icon.ico - Sizes: 16×16, 24×24, 32×32, 48×48, 64×64, 256×256
- Format: Multi-layer ICO file with PNG compression for 256×256
- Directory:
macos/ - Files:
icon.icns,Contents.json - Sizes: 16×16, 32×32, 128×128, 256×256, 512×512, 1024×1024 (including @2x variants)
- Format: Apple ICNS format
- Directory:
linux/ - Files:
32x32.png,64x64.png,128x128.png,256x256.png,icon.png(512×512) - Format: PNG with transparency
- Directory:
tauri-desktop/ - Files:
32x32.png,128x128.png,128x128@2x.png,icon.ico,icon.icns - Purpose: Ready-to-use icons for Tauri's
src-tauri/iconsfolder
- Directory:
android/mipmap-*/ - Files:
ic_launcher.pngin each density folder - Densities: mdpi (48×48), hdpi (72×72), xhdpi (96×96), xxhdpi (144×144), xxxhdpi (192×192)
- Directory:
ios/ - Files: Various
AppIcon-*files for different iOS icon requirements - Sizes: 20×20 to 1024×1024 with @1x, @2x, @3x variants
- Background: Applies specified background color (iOS requires opaque icons)
- Asset Catalog: Automatic generation of
Contents.jsonfor Xcode compatibility
The --dev-mode flag (alias: --debug) adds a visual development badge overlay to all generated icons. This feature is useful for:
- Development builds: Easily distinguish development icons from production icons
- Testing environments: Visual indicator for QA and staging builds
- Beta releases: Mark pre-release versions with a clear visual indicator
The badge uses charming bug images (moth, cockroach, ladybug, spider, or caterpillar) that are automatically scaled and centered on each icon. The default bug is a moth with random rotation for visual variety.
moth(default): Classic moth with random rotation (0-360°)cockroach: Cockroach with fixed orientationladybug: Ladybug with fixed orientationspider: Spider with fixed orientationcaterpillar: Caterpillar with fixed orientation
# Use default moth with random rotation
icon-gen source.png --dev-mode
# Specify different bug types
icon-gen source.png --dev-mode --dev-bug spider
icon-gen source.png --dev-mode --dev-bug ladybug
icon-gen source.png --dev-mode --dev-bug cockroach
icon-gen source.png --dev-mode --dev-bug caterpillar
# Combine with other options
icon-gen source.png --dev-mode --dev-bug moth --mobile-only- Smart Scaling: Bugs automatically scale to 1/4 of the icon size
- Perfect Centering: Bugs are precisely centered on each icon
- Random Rotation: Moth gets random rotation for visual variety
- Cross-Platform: Works across all supported formats (ICO, ICNS, PNG, Android, iOS)
- Alpha Blending: Seamless overlay with proper transparency handling
This tool automatically generates Apple's Contents.json files for both iOS and macOS platforms, making the generated icons ready for use in Xcode projects without any additional configuration.
- Purpose: Defines metadata for iOS app icons including sizes, scales, idioms, and roles
- Compatibility: Works with all iOS devices (iPhone, iPad, and iOS Marketing)
- Roles: Includes proper roles for notification center, spotlight, app launcher, and companion settings
- No Xcode Post-processing: Icons are immediately ready for use in iOS projects
- Purpose: Defines metadata for macOS app icons with proper scaling and size information
- Compatibility: Supports all macOS icon sizes from 16×16 to 1024×1024 with @1x and @2x variants
- Integration: Works seamlessly with macOS app bundles and Xcode projects
- No Xcode Post-processing: Icons are immediately ready for use in macOS projects
The generated Contents.json files follow Apple's official Asset Catalog Format Reference, ensuring full compatibility with Xcode and the Apple development ecosystem.
- Format: PNG (other formats supported by the
imagecrate may work) - Size: Must be square (width = height)
- Recommended: 1024×1024 or larger for best quality
- Transparency: Supported (except iOS icons which get background color applied)
icon-gen app-icon-1024.pngicon-gen app-icon.png --desktop-onlyicon-gen favicon-source.png -p 16,32,48 -o favicon-outputicon-gen transparent-icon.png --ios-color "#2196F3"icon-gen app-icon.png --mobile-only# Generate only Windows icons
icon-gen app-icon.png --windows
# Generate only mobile app icons (alternative approach)
icon-gen app-icon.png --android --ios
# Generate desktop icons only (alternative approach)
icon-gen app-icon.png --windows --macos --linux
# Generate Linux icons with custom sizes
icon-gen app-icon.png --linux -p 16,24,32,48,64,128,256# Generate only Tauri desktop icons (recommended for Tauri)
icon-gen app-icon.png --tauri-desktop
# The tauri-desktop folder can be directly copied to src-tauri/icons
# Simply drag and drop the contents into your Tauri project# Add a bug overlay to all generated icons for development builds
icon-gen app-icon.png --dev-mode
# Specify which bug to use
icon-gen app-icon.png --dev-mode --dev-bug spider
icon-gen app-icon.png --dev-mode --dev-bug caterpillar
# Combine with other options
icon-gen app-icon.png --dev-mode --mobile-only
icon-gen app-icon.png --dev-mode --ios-color "#2196F3"
icon-gen app-icon.png --dev-mode --dev-bug ladybug --android --iosWhen generating all formats, the output directory structure will be:
{output}/ # Default: icon-generator-{source-name}/
├── windows/ # Windows icons
│ └── icon.ico
├── macos/ # macOS icons
│ ├── icon.icns
│ └── Contents.json # macOS Asset Catalog metadata
├── linux/ # Linux desktop icons
│ ├── 32x32.png
│ ├── 64x64.png
│ ├── 128x128.png
│ ├── 256x256.png
│ └── icon.png # 512x512
├── tauri-desktop/ # Tauri desktop icons
│ ├── 32x32.png
│ ├── 128x128.png
│ ├── 128x128@2x.png
│ ├── icon.ico
│ └── icon.icns
├── android/ # Android icons
│ ├── mipmap-mdpi/
│ │ └── ic_launcher.png
│ ├── mipmap-hdpi/
│ │ └── ic_launcher.png
│ └── ...
└── ios/ # iOS icons
├── Contents.json # iOS Asset Catalog metadata
├── AppIcon-20x20@1x.png
├── AppIcon-20x20@2x.png
├── AppIcon-29x29@1x.png
├── AppIcon-29x29@2x.png
├── AppIcon-40x40@1x.png
├── AppIcon-40x40@2x.png
├── AppIcon-60x60@2x.png
├── AppIcon-60x60@3x.png
├── AppIcon-76x76@1x.png
├── AppIcon-76x76@2x.png
├── AppIcon-83x83@2x.png
└── AppIcon-1024x1024.png
- Rust 1.70+ (install from rustup.rs)
- System dependencies for image processing (usually included)
# Debug build
cargo build
# Release build (optimized)
cargo build --release
# Run tests
cargo test
# Install locally
cargo install --path .Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by the Tauri CLI icon generation functionality
- Built with the Rust ecosystem's excellent image processing libraries