Skip to main content

Generate pixel perfect icons from Iconify, URLs, and local files and export to PNG, SVG, WebP, or ICO

Project description

icon-gen-ai

Python 3.10+ License: MIT PyPI version Tests Coverage GitHub last commit Downloads

Generate customizable icons from Iconify, direct URLs, or local files with easy export to PNG, SVG, WebP, and ICO formats.

Features

AI-assisted icon search and generation
Simple and intuitive CLI and Python API
Access 275,000+ icons from Iconify
Unlimited icons from direct URLs or local files
Customize colors, sizes, and backgrounds and adjust border radius
Gradient color option for icons and backgrounds
Export to SVG, PNG, WEBP, or ICO format

Installation

pip install icon-gen-ai

(Optional) AI features:

pip install icon-gen-ai[ai]

Quick Start

Generate Single Icons

Claude Gemini Mistral OpenAI
from icon_gen_ai import IconGenerator

generator = IconGenerator(output_dir="output")

# From URL
generator.generate_icon(
    direct_url='https://upload.wikimedia.org/wikipedia/commons/b/b0/Claude_AI_symbol.svg',
    output_name='claude_white_mediumslateblue_bg',
    color='white',
    bg_color='mediumslateblue',
    border_radius=0,
    size=256
)

# From Iconify
generator.generate_icon(
    icon_name='simple-icons:googlegemini',
    output_name='gemini_white_deeppink_bg',
    color='white',
    bg_color='deeppink',
    border_radius=128,  # Circle (half of size)
    size=256
)

# From Iconify 
generator.generate_icon(
    icon_name='simple-icons:mistralai',
    output_name='mistral_white_gradient_bg',
    color='white',
    bg_color=('mediumslateblue', 'deeppink'),  # Gradient
    direction="vertical",
    border_radius=48,
    size=256
)

# From Iconify 
generator.generate_icon(
    icon_name='simple-icons:openai',
    output_name='openai_gradient_transparent_bg',
    color=('mediumslateblue', 'deeppink'),  # Gradient icon
    direction="diagonal",
    bg_color=None,
    size=256
)

Generate Multiple Icons (Batch)

Llama DeepSeek Nemotron Grok
from icon_gen_ai import IconGenerator

generator = IconGenerator(output_dir="output")

# Generate multiple icons at once
ai_icons = {
    'llama_deepskyblue': 'simple-icons:meta',
    'deepseek_deepskyblue': {
        'local_file': 'input/deepseek-icon.png'
    },
    'nemotron_deepskyblue': {
        'url': 'https://companieslogo.com/img/orig/NVDA-df4c2377.svg'
    },
    'grok_deepskyblue': {
        'url': 'https://unpkg.com/@lobehub/icons-static-svg@latest/icons/grok.svg'
    }
}

generator.generate_batch(ai_icons, color='deepskyblue', size=256, outline_color='deepskyblue', outline_width=8, border_radius=48)

Animation Support

When you apply a solid color to an animated SVG icon, the animations are automatically preserved:

bars scale my location loop speedometer loop upload outline loop
from icon_gen_ai import IconGenerator

generator = IconGenerator(output_dir="output")

color = 'mediumslateblue' 

animated_icons = {
    f'speedometer_loop_{color}': 'line-md:speedometer-loop',
    f'upload_outline_loop_{color}': 'line-md:upload-outline-loop',
    f'my_location_loop_{color}': 'line-md:my-location-loop',
    f'bars_scale_middle_{color}': 'svg-spinners:bars-scale-middle'
}

generator.generate_batch(animated_icons, color=color, size=256, outline_color='springgreen', bg_color='snow', outline_width=8, border_radius=48)

What preserves animations:

  • Solid colors
  • No color specified (original colors)
  • Backgrounds and outlines

What removes animations:

  • Gradient colors on the icon itself: color=('deeppink', 'mediumslateblue')

Note: Background gradients don't affect icon animations - only icon color gradients do.

CLI Usage

Below is the full output of icon-gen-ai --help:

Usage: icon-gen-ai [OPTIONS] COMMAND [ARGS]...

  icon-gen-ai — generate icons from Iconify, URLs, or local files.

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  generate   Generate icons from Iconify or local files.
  providers  Show AI provider status.
  search     Search for icons using AI-powered natural language queries.

Read the documentation for more detailed instructions.

Icon Sources

Three ways to get icons:

1. Iconify (275,000+ icons)

Browse at Iconify

# Format: collection:icon-name
'simple-icons:openai'           # Simple Icons by Simple Icons Collaborators (License: CC0 1.0)  
'mdi:github'                    # Material Design Icons by Pictogrammers (License: Apache 2.0)  
'devicon:fastapi'               # Devicon by konpa (License: MIT)  
'gis:drone'                     # Font-GIS by Jean-Marc Viglino (License: CC BY 4.0)  

AI-powered search (requires pip install icon-gen-ai[ai]):

icon-gen-ai search "payment icons for checkout" --generate

2. Direct URL

Any public image URL:

direct_url='https://upload.wikimedia.org/wikipedia/commons/b/b0/Claude_AI_symbol.svg'
direct_url='https://companieslogo.com/img/orig/NVDA-df4c2377.svg'

3. Local File

Locally saved images:

local_file='input/my-icon.svg'
local_file='input/my-icon.png'

Examples

Check out the examples/ directory for more use cases:

Basic Generation:

  • generate_ai_icons_singular.py - Generate icons one-by-one with custom backgrounds & gradients
  • generate_ai_icons_batch.py - Generate multiple AI model icons at once (batch mode)

AI-Powered Search (requires pip install icon-gen-ai[ai]):

  • ai_simple_usage.py - Search and generate icons using natural language
  • ai_icon_search.py - Advanced search with custom styles and project context

Development

# Clone the repository
git clone https://github.com/yauheniya-ai/icon-gen-ai.git
cd icon-gen-ai

# Install all dependencies (including dev tools)
uv sync --extra ai --dev

# Run tests
uv run pytest --cov=src --cov-report=term-missing

License

MIT License – see LICENSE file for details.

Author

Yauheniya Varabyova (yauheniya.ai@gmail.com)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

icon_gen_ai-0.2.25.tar.gz (29.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

icon_gen_ai-0.2.25-py3-none-any.whl (26.8 kB view details)

Uploaded Python 3

File details

Details for the file icon_gen_ai-0.2.25.tar.gz.

File metadata

  • Download URL: icon_gen_ai-0.2.25.tar.gz
  • Upload date:
  • Size: 29.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for icon_gen_ai-0.2.25.tar.gz
Algorithm Hash digest
SHA256 4b7a7fa2e02cb45f577b4f18e04c4fdbbe53f817f598dd9c786b45fdcfa8eb13
MD5 672786f78d3c902b0975e18e3a0ac0a9
BLAKE2b-256 cabd3ba099076ac359b6a666db48cb771d6a06f6a527ebecc6f9a4a44d9f8059

See more details on using hashes here.

File details

Details for the file icon_gen_ai-0.2.25-py3-none-any.whl.

File metadata

  • Download URL: icon_gen_ai-0.2.25-py3-none-any.whl
  • Upload date:
  • Size: 26.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for icon_gen_ai-0.2.25-py3-none-any.whl
Algorithm Hash digest
SHA256 9c9e916a6673aca9168739730c1ed57ce7bd2c90becb8492900b9ea47d54910a
MD5 0df72d2d4185f154cbf1ddbe19dc1ece
BLAKE2b-256 bb038cdace18eaed3f964c9b638d9fe11afe0a12466f563f5bf33116cfd3ba4a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page