A command-line tool for generating favicons from source images
Project description
FaviconX 🎨
A powerful command-line tool for generating favicons from source images. Automatically creates all standard favicon sizes and generates an index.html file with proper meta tags.
Features
- ✅ Generates all standard favicon sizes (16x16 to 1024x1024)
- ✅ Creates ICO, SVG, and PNG formats
- ✅ Apple Touch Icons for iOS devices
- ✅ Android Chrome Icons for PWA support
- ✅ Microsoft Tile support
- ✅ Automatic HTML generation with proper meta tags
- ✅ Web App Manifest for PWA support
- ✅ High-quality image resizing with LANCZOS algorithm
- ✅ Support for various input formats (PNG, JPG, SVG, etc.)
Installation
-
Clone or download this repository
git clone https://github.com/rapidrabbitsoft/faviconx cd faviconx
-
Install dependencies
pip install -r requirements.txt
-
Make the script executable (optional)
chmod +x faviconx.py
Usage
Basic Usage
python faviconx.py <source_image> <output_directory>
Examples
# Generate favicons from a logo
python faviconx.py logo.png ./favicons
# Generate favicons with verbose output
python faviconx.py logo.png ./favicons --verbose
# Generate only favicons (skip HTML files)
python faviconx.py logo.png ./favicons --no-html
Command Line Options
source_image: Path to your source image fileoutput_directory: Directory where favicons will be saved--no-html: Skip generating index.html and webmanifest files--verbose, -v: Enable verbose output
Generated Files
The tool generates the following files:
Favicon Files
favicon.ico- Multi-size ICO file (16x16, 32x32, 48x48)favicon.svg- SVG faviconfavicon-16x16.pngtofavicon-1024x1024.png- PNG favicons in all sizes
Apple Touch Icons
apple-touch-icon-180x180.pngapple-touch-icon-167x167.pngapple-touch-icon-152x152.pngapple-touch-icon-120x120.png
Android Chrome Icons
android-chrome-192x192.pngandroid-chrome-512x512.png
HTML Files
index.html- Complete HTML file with all favicon meta tagssite.webmanifest- Web App Manifest for PWA support
Supported Input Formats
- PNG
- JPEG/JPG
- GIF
- BMP
- TIFF
- WebP
- SVG (basic support)
Favicon Sizes Generated
The tool generates favicons in the following sizes:
- 16×16
- 32×32
- 48×48
- 64×64
- 57×57
- 72×72
- 96×96
- 114×114
- 120×120
- 128×128
- 144×144
- 150×150
- 152×152
- 167×167
- 180×180
- 192×192
- 256×256
- 384×384
- 512×512
- 1024×1024
Favicon Icon Matrix
| Size | Filename | Usage | Status |
|---|---|---|---|
| ICO | .ico | Windows icon format. Contains multiple sizes in one file. | Required |
| 16×16 | 16×16.png | Browser tab favicon (classic). Minimum for all browsers. | Required |
| SVG | .svg | Scalable vector format. Crisp at any size. | Required |
| 32×32 | 32×32.png | High-DPI favicons / pinned tabs. Retina screens, previews. | Recommended |
| 48×48 | 48×48.png | Windows .ico format (legacy). Included in .ico bundles. | Optional |
| 64×64 | 64×64.png | Windows 7+ tile icon (legacy). Rarely used now. | Optional |
| 57×57 | 57×57.png | iOS 6 (iPhone 1–3) home screen. Deprecated, backward compat. | Legacy |
| 72×72 | 72×72.png | iOS 6 (iPad). For old iPad models. | Legacy |
| 96×96 | 96×96.png | Android 2.3+ launcher icons (deprecated). Historical support. | Optional |
| 114×114 | 114×114.png | iPhone Retina (iOS 4–6). Useful for legacy iPhones. | Optional |
| 120×120 | 120×120.png | iPhone Retina (iOS 7+). Still used on some devices. | Recommended |
| 128×128 | 128×128.png | Chrome Web Store app icon (legacy). Only for Chrome apps. | Optional |
| 144×144 | 144×144.png | Windows 8+ tile icon. Required for Microsoft tiles. | Recommended |
| 150×150 | 150×150.png | Microsoft Teams / Outlook preview. Some MS services prefer. | Optional |
| 152×152 | 152×152.png | iPad Retina (iOS 7+). Common for newer iPads. | Recommended |
| 167×167 | 167×167.png | iPad Pro Retina. Used in newer iPads (Pro). | Recommended |
| 180×180 | 180×180.png | iOS Safari home screen (iOS 8+). Most used for iOS. | Required |
| 192×192 | 192×192.png | Android Chrome home screen / PWA icon. Must-have for PWAs. | Required |
| 256×256 | 256×256.png | Windows & Linux high-res icons. Some desktop envs. | Optional |
| 384×384 | 384×384.png | Android launcher (high-res devices). High-DPI Android. | Optional |
| 512×512 | 512×512.png | Android splash / PWA install dialog icon. Manifest required. | Required |
| 1024×1024 | 1024×1024.png | iOS App Store icons (native apps, not web). For completeness. | Optional |
Legend:
- Required: R
- Recommended: RC
- Optional: O
- Legacy: L
HTML Meta Tags Included
The generated index.html includes comprehensive meta tags for:
- Standard favicon support
- Apple Touch Icons
- Android Chrome Icons
- Microsoft Tiles
- Web App Manifest
- PWA support
- Mobile web app capabilities
Requirements
- Python 3.9+
- Pillow (PIL)
- Click
- CairoSVG
Troubleshooting
Common Issues
-
"Source image not found"
- Make sure the path to your source image is correct
- Use absolute paths if needed
-
Permission errors
- Ensure you have write permissions for the output directory
- Create the output directory manually if needed
-
Image format not supported
- Convert your image to PNG or JPEG format
- Ensure the image file is not corrupted
Tips for Best Results
- Use high-resolution source images (at least 512x512 pixels)
- Use PNG format for source images with transparency
- Ensure your logo has good contrast for small sizes
- Test the generated favicons in different browsers and devices
Browser Support
The generated favicons support:
- Chrome/Chromium
- Firefox
- Safari
- Edge
- Internet Explorer 11+
- Mobile browsers (iOS Safari, Chrome Mobile)
License
This project is open source and available under the MIT License.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
If you encounter any issues or have questions, please open an issue on the repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file faviconx-1.0.0.tar.gz.
File metadata
- Download URL: faviconx-1.0.0.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35670f3e394aa78b627bb1bcd34c8a2442ff2a0b1ae6e686be2c224eaf60db60
|
|
| MD5 |
620a8765d2306eca74977d708c34ffb5
|
|
| BLAKE2b-256 |
9ebd0720cf4046ba7d1870059efb606544b319c06a5ca15326aadb89701d8a71
|
File details
Details for the file faviconx-1.0.0-py3-none-any.whl.
File metadata
- Download URL: faviconx-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ddfa9a9e8d75d3ab6b10db4e7a57ac7e614262c91ecd89172fe980fc2d53eaa
|
|
| MD5 |
561ba02d1663ce2d2753cfbd4ba0ef12
|
|
| BLAKE2b-256 |
60d2fb1c1c70ac30977293332cbdc39730f6db0719106db73b57bae37055a0df
|