mirror of
https://codeberg.org/Pontoporeia/favigen.git
synced 2026-01-21 03:30:56 +01:00
A rust CLI to generate favicons.
- Rust 96%
- Nix 4%
| assets | ||
| src | ||
| test_files | ||
| tests | ||
| .gitignore | ||
| BUILDING.md | ||
| Cargo.toml | ||
| CONTRIBUTING.md | ||
| flake.nix | ||
| LICENSE | ||
| README.md | ||
Favigen
A fast and efficient CLI tool written in Rust for generating a complete set of favicons and web app icons from a single source image.
✨ Features
- 🎨 Multiple Input Formats: PNG, JPEG, GIF, WebP, AVIF, and SVG
- 📱 Complete Icon Set: All standard favicon sizes (16x16 to 512x512)
- 🌐 Web Ready: HTML snippet and web app manifest included
- ⚡ High Performance: Built with Rust for maximum speed
- 🔧 SVG Auto-Fix: Automatically repairs common SVG formatting issues
- 📦 Zero Dependencies: Self-contained binary with no runtime dependencies
🚀 Installation
Binary Releases
Download pre-built binaries from the releases page.
Currently available for:
- Linux x86_64
Via Cargo
cargo install --git https://codeberg.org/Pontoporeia/favigen
From Source
For detailed build instructions, see BUILDING.md.
git clone https://codeberg.org/Pontoporeia/favigen.git
cd favigen
cargo build --release
📋 Usage
Quick Start
# Generate favicons from any supported image format
favigen logo.png
favigen logo.svg -o ./assets/icons
favigen logo.webp --output ./favicons --verbose
Command Line Options
favigen [OPTIONS] <INPUT>
Arguments:
<INPUT> Input image file (PNG, JPEG, GIF, WebP, AVIF, SVG)
Options:
-o, --output <OUTPUT> Output directory [default: ./favicons]
-v, --verbose Verbose output
-h, --help Print help
-V, --version Print version
Examples
# Basic usage - generates files in ./favicons/
favigen logo.png
# Custom output directory
favigen assets/brand.svg -o public/icons
# Verbose output to see generation progress
favigen logo.webp -v
# SVG with auto-fix for malformed files
favigen broken-logo.svg --verbose
📦 Generated Files
Favigen creates a comprehensive favicon package (14 files total):
🖼️ PNG Icons
- Standard Favicons: 16×16, 32×32, 48×48, 64×64, 96×96, 128×128
- Apple Touch Icons: 152×152 (iPad), 167×167 (iPad Pro), 180×180 (iPhone)
- Android Icons: 192×192 (standard), 512×512 (splash screen)
📄 Configuration Files
favicon.ico- Multi-size ICO file (16, 32, 48, 64px)site.webmanifest- Progressive Web App manifestfavicon_html.txt- Ready-to-use HTML snippet
📊 File Sizes
Typical output for a 512×512 source image:
- Total package: ~150-200KB
- Individual icons: 500B-50KB each
- Zero quality loss from source
🌐 Integration
1. Copy Files
# Copy generated files to your website's root
cp favicons/* /path/to/your/website/
2. Add HTML Tags
Copy the contents of favicon_html.txt to your <head> section:
<link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="167x167" href="/apple-touch-icon-167x167.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="shortcut icon" href="/favicon.ico">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="theme-color" content="#ffffff">
3. Customize Web App Manifest
Edit site.webmanifest for your app:
{
"name": "Your App Name",
"short_name": "YourApp",
"icons": [...],
"theme_color": "#your-color",
"background_color": "#your-bg-color",
"display": "standalone"
}
✅ Browser Support
- All modern browsers (Chrome, Firefox, Safari, Edge)
- Mobile devices (iOS Safari, Android Chrome)
- Progressive Web Apps (PWA)
- Legacy browsers (via favicon.ico)
🔧 Development
Contributing
Contributions are welcome! See CONTRIBUTING.md for guidelines.
Building from Source
Detailed build instructions are available in BUILDING.md.
Dependencies
This tool uses high-quality Rust crates:
image- Image processing and format supportresvg/usvg/tiny-skia- SVG rendering engineico- ICO file generationclap- Command line interfaceserde/serde_json- Configuration serializationanyhow- Error handling
📄 License
AGPL 3.0 License - see LICENSE file for details.
🎨 Credits
- Logo: Phosphor Icons
- SVG Engine: resvg project
- Image Processing: image-rs community
📞 Support
- 🐛 Bug Reports: Open an issue
- 💡 Feature Requests: Start a discussion
- 📖 Documentation: BUILDING.md | CONTRIBUTING.md
Made with ❤️ and ⚡ Rust