Python library for exporting icons from icon fonts (e.g. Font Awesome, Octicons) as PNG images.
Project description
Python library made for easy and simple export of icons from web icon fonts (e.g. Font Awesome, Octicons) as PNG images. It comes with a shell script wrapping its functionality, which is it’s main focus, but can also be imported and used directly in your Python project.
There’s also font-awesome-to-png script for backwards compatibility with the first iteration of the concept.
Package is considered to be in beta status and no backwards compatibility (if you use it inside your project) between (minor) versions is provided.
Packages required for running and testing are listed in requirements directory.
Installation
Make sure you have required packages for Pillow installation.
With pip (recommended):
$ pip install icon_font_to_png
Without pip:
$ git clone https://github.com/Pythonity/icon-font-to-png $ pip install -r icon-font-to-png/requirements.txt $ cd icon-font-to-png/bin
Usage
usage: icon-font-to-png [-h] [--list] [--download {font-awesome,octicons}] [--ttf TTF-FILE] [--css CSS-FILE] [--size SIZE] [--scale SCALE] [--color COLOR] [--filename FILENAME] [--keep_prefix] [icons [icons ...]] Exports font icons as PNG images. optional arguments: -h, --help show this help message and exit --list list all available icon names and exit --download {font-awesome,octicons} download latest icon font and exit required arguments: --ttf TTF-FILE path to TTF file --css CSS-FILE path to CSS file exporting icons: icons names of the icons to export (or 'ALL' for all icons) --size SIZE icon size in pixels (default: 16) --scale SCALE scaling factor between 0 and 1, or 'auto' for automatic scaling (default: auto); be careful, as setting it may lead to icons being cropped --color COLOR HTML color code or name (default: black) --filename FILENAME name of the output file (without '.png' extension); it's used as a prefix if multiple icons are exported --keep_prefix do not remove common icon prefix (i.e. 'fa-arrow- right' instead of 'arrow-right')
Examples
API
You can use IconFont (and FontAwesomeDownloader/OcticonsDownloader for that matter) directly inside your Python project. There’s no documentation as of now, but the code is commented and should be pretty straightforward to use.
But feel free to ask me if anything is unclear.
Tests
Package was tested with tox on Python 2.7 and Python 3.4 (see tox.ini).
To run tests yourself, just run tox inside repository.
Contributions
Package source code is available at GitHub.
Feel free to use, ask, fork, star, report bugs, fix them, suggest enhancements and point out any mistakes.
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
File details
Details for the file icon_font_to_png-0.2.1.tar.gz
.
File metadata
- Download URL: icon_font_to_png-0.2.1.tar.gz
- Upload date:
- Size: 120.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4cdcb7e60f78cdfb9c1a73ec5bbccd6e94c4ab202071ba015100efa6d0b0e274 |
|
MD5 | 758ec6b8e37dd39526f352671a45bec1 |
|
BLAKE2b-256 | a9a81e4f26ee2afd5a65c948317da435b1b0ae38a1ef402a46b54261a58cc9ba |
File details
Details for the file icon_font_to_png-0.2.1-py2.py3-none-any.whl
.
File metadata
- Download URL: icon_font_to_png-0.2.1-py2.py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b4b87bf814d3f5c0a4811849da2871d5f69c883488318a1faf7472db829c5bd |
|
MD5 | 346ca66142d4559ae9de890d23432484 |
|
BLAKE2b-256 | 5cf74857ccaa0f50fe4f2dbb4eadd348131b6bfd830e3cd657c6abdc01196e92 |