Skip to main content

Python script for exporting icons from icon font (e.g. Font Awesome, Octicons) as PNG images.

Project description

Version License

Python (2 & 3 compatible) script for exporting icons from icon font (e.g. Font Awesome, Octicons) as PNG images. It also comes with font-awesome-to-png script for backward compatibility.

Packages required for running and testing are listed in requirements directory.

Feel free to use, ask, fork, report bugs, fix them, suggest enhancements and point out any mistakes.

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

Download latest Font Awesome:
$ icon-font-to-png --download font-awesome
List all available icons:
$ icon-font-to-png --css font-awesome.css --ttf fontawesome-webfont.ttf --list
Export ‘play’ and ‘stop’ icons, size 64x64:
$ icon-font-to-png --css font-awesome.css --ttf fontawesome-webfont.ttf --size 64 play stop
Export all icons in blue:
$ icon-font-to-png --css font-awesome.css --ttf fontawesome-webfont.ttf --color blue ALL
Or you can use font-awesome-to-png, which works analogously:
$ font-awesome-to-png ALL

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.

Authors

Developed and maintained by Pythonity

Original version by Michał Wojciechowski, refactored by Paweł Adamczak

Project details


Download files

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

Source Distribution

icon_font_to_png-0.1.4.tar.gz (119.1 kB view details)

Uploaded Source

Built Distribution

icon_font_to_png-0.1.4-py2.py3-none-any.whl (11.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file icon_font_to_png-0.1.4.tar.gz.

File metadata

File hashes

Hashes for icon_font_to_png-0.1.4.tar.gz
Algorithm Hash digest
SHA256 ceace17aed58a7bf622113e25587a8557cd07d097f3054761bb65feaa0576aab
MD5 fc4a422afd77880b9b91afb40f8d2433
BLAKE2b-256 8398f0077afa1f78a3cbcd8f4b0e06b327fd0a3ed17946b9155a3b4da00a830f

See more details on using hashes here.

File details

Details for the file icon_font_to_png-0.1.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for icon_font_to_png-0.1.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 73b5254d5fa273c6f0a7e2cf7977eaa0c406a365f7677260793e6bc140389d84
MD5 6b62f88a799c1ce1087ed98d2c01e232
BLAKE2b-256 bd544ecadb810e6fb9613786045c482bb1313036c399541dce4cdb7e362156b1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page