Skip to main content

img2ico

CI docs release-pypi

Ruff mypy

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 .ico file (16x16, 32x32, 48x48 by 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 browsers
  • 32x32 – high DPI displays
  • 48x48 – 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

Download files

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

Source Distribution

img2ico-0.1.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

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

img2ico-0.1.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file img2ico-0.1.0.tar.gz.

File metadata

  • Download URL: img2ico-0.1.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for img2ico-0.1.0.tar.gz
Algorithm Hash digest
SHA256 db723774ea676aefee63f0ef396added3e8023ad59a86c968a54015eca4762ca
MD5 2acd51275337d8b491666333cf0d1ce8
BLAKE2b-256 956536a627e2b47f1bbe1c492e4c4ed037b1a455c6d6250ffe4fd887273e2270

See more details on using hashes here.

Provenance

The following attestation bundles were made for img2ico-0.1.0.tar.gz:

Publisher: release-pypi.yml on yu9824/img2ico

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file img2ico-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: img2ico-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for img2ico-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 64cca7d95b20fd725d4cc46770008eda61789f08353316e59b6cf8899519f437
MD5 61130672485867c24bfe7190e4a63e62
BLAKE2b-256 cc5b7464211313e47e6f54c65bbe8ad3d61998b5aa1e4189b77b9fa1669cd8f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for img2ico-0.1.0-py3-none-any.whl:

Publisher: release-pypi.yml on yu9824/img2ico

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

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