Metadata-Version: 2.4
Name: img2ico
Version: 0.1.0rc0
Author: yu9824
Maintainer: yu9824
License: MIT License
        
        Copyright (c) 2025 yu9824
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/yu9824/img2ico
Project-URL: PyPI, https://pypi.org/project/img2ico/
Project-URL: Source, https://github.com/yu9824/img2ico
Project-URL: Tracker, https://github.com/yu9824/img2ico/issues
Project-URL: Changelog, https://github.com/yu9824/img2ico/blob/main/CHANGELOG.md
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pillow>=10.0.0
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Provides-Extra: svg
Requires-Dist: cairosvg>=2.7.0; extra == "svg"
Provides-Extra: optional
Requires-Dist: colorlog; extra == "optional"
Requires-Dist: tqdm; extra == "optional"
Provides-Extra: docs
Requires-Dist: sphinx; extra == "docs"
Requires-Dist: sphinx_rtd_theme; extra == "docs"
Requires-Dist: sphinx-markdown-tables; extra == "docs"
Requires-Dist: recommonmark; extra == "docs"
Provides-Extra: gui
Requires-Dist: TkEasyGUI; extra == "gui"
Dynamic: license-file

# img2ico

<!-- badges -->
[![CI](https://github.com/yu9824/img2ico/actions/workflows/CI.yml/badge.svg)](https://github.com/yu9824/img2ico/actions/workflows/CI.yml)
[![docs](https://github.com/yu9824/img2ico/actions/workflows/docs.yml/badge.svg)](https://github.com/yu9824/img2ico/actions/workflows/docs.yml)
[![release-pypi](https://github.com/yu9824/img2ico/actions/workflows/release-pypi.yml/badge.svg)](https://github.com/yu9824/img2ico/actions/workflows/release-pypi.yml)

<!--
[![python_badge](https://img.shields.io/pypi/pyversions/img2ico)](https://pypi.org/project/img2ico/)
[![license_badge](https://img.shields.io/pypi/l/img2ico)](https://pypi.org/project/img2ico/)
[![PyPI version](https://badge.fury.io/py/img2ico.svg)](https://pypi.org/project/img2ico/)
[![Downloads](https://static.pepy.tech/badge/img2ico)](https://pepy.tech/project/img2ico)

[![Conda Version](https://img.shields.io/conda/vn/conda-forge/img2ico.svg)](https://anaconda.org/conda-forge/img2ico)
[![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/img2ico.svg)](https://anaconda.org/conda-forge/img2ico)
-->

[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://github.com/python/mypy)
<!-- /badges -->

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

```bash
pip install pillow
# Optional: for SVG input support
pip install cairosvg
````

Or if you publish this as a package:

```bash
pip install img2ico
# with SVG support
pip install img2ico[svg]
```

## Usage

### CLI

```bash
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

```python
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:

```bash
git clone https://github.com/yourname/img2ico.git
cd img2ico
pip install -e ".[svg]"
```

Run tests or try the CLI:

```bash
python -m img2ico input.png
```

## License

MIT


