img2ico
A simple CLI tool and Python library to convert images into multi-resolution favicon (.ico) files.
Features
- Convert PNG, JPG, WEBP, BMP to ICO
- Optional SVG support (requires
cairosvg) - Embed multiple icon sizes in one
.icofile (16x16,32x32,48x48by default) - Easy to use CLI and Python API
Installation
pip install pillow
# Optional: for SVG input support
pip install cairosvg
Or if you publish this as a package:
pip install img2ico
# with SVG support
pip install img2ico[svg]
Usage
CLI
img2ico input.png -o favicon.ico -s 16 32 48
Options:
| Option | Description |
|---|---|
-o, --output |
Output file name (default: same as input, with .ico extension) |
-s, --sizes |
Icon sizes to embed (space-separated). Default: 16 32 48 |
-v, --version |
Show current version |
Python API
from pathlib import Path
from img2ico import convert_to_ico
convert_to_ico(
input_path=Path("logo.png"),
output_path=Path("favicon.ico"),
sizes=[(16, 16), (32, 32), (48, 48)],
)
Recommended Sizes
For favicon usage, it is recommended to include:
16x16– browser tab, old browsers32x32– high DPI displays48x48– Windows desktop icons
You can also add 64x64 or larger if you want to future-proof, but it is not strictly necessary.
Development
Clone the repository and install dependencies:
git clone https://github.com/yourname/img2ico.git
cd img2ico
pip install -e ".[svg]"
Run tests or try the CLI:
python -m img2ico input.png
License
MIT
Metadata
Release files for img2ico 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| img2ico-0.1.0.tar.gz | 11.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| img2ico-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.4 kB
Release files / img2ico-0.1.0.tar.gz
| Download URL | img2ico-0.1.0.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db723774ea676aefee63f0ef396added3e8023ad59a86c968a54015eca4762ca
|
|
BLAKE2b-256 checksum How to use checksums |
956536a627e2b47f1bbe1c492e4c4ed037b1a455c6d6250ffe4fd887273e2270
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2025.
Transparency logRelease files / img2ico-0.1.0-py3-none-any.whl
| Download URL | img2ico-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64cca7d95b20fd725d4cc46770008eda61789f08353316e59b6cf8899519f437
|
|
BLAKE2b-256 checksum How to use checksums |
cc5b7464211313e47e6f54c65bbe8ad3d61998b5aa1e4189b77b9fa1669cd8f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2025.
Transparency log