A simple Python library to create .ico
files (Windows icon file format) from .png
files.
Table of contents
Use the PyPi.org package index:
pip3 install icoutil
Two ways to use the library:
-
Creating a
.ico
file from a single directory that contains multiple.png
files:import icoutil ico = icoutil.IcoFile() ico.add_png_dir('path/to/dir') ico.write('output.ico')
-
Creating a
.ico
file from multiple.png
files:import icoutil ico = icoutil.IcoFile() ico.add_png('path/to/image1.png') ico.add_png('path/to/image2.png') ico.add_png('path/to/image3.png') ico.add_png('...') ico.write('output.ico')
Two ways to use the CLI:
-
Creating a
.ico
file from a single directory that contains multiple.png
files:icoutil --output "icon.ico" "path/to/dir"
-
Creating a
.ico
file from multiple.png
files:icoutil --output "icon.ico" "path/to/image1.png" "path/to/image2.png" "path/to/image3.png" ...
- The file specification can be read here.
- The following sizes are used by Windows, but not all required:
- 16ร16
- 20ร20
- 24ร24
- 32ร32
- 40ร40
- 48ร48
- 64ร64
- 96ร96
- 128ร128
- 256ร256
- This library won't consider sizes outside the ones specified above.
- The maximum allowed size is 256ร256 pixels.
Olivier Clรฉro | email | website | github | gitlab
This project is available under the MIT license. See the LICENSE file for more info.