New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

icon_font_to_png

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

icon_font_to_png

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

  • 0.4.1
  • PyPI
  • Socket score

Maintainers
1

Icon Font to PNG

|Build status| |Test coverage| |PyPI version| |Python versions| |License|

Python script (and library) for easy and simple export of icons from web icon fonts (e.g. Font Awesome, Octicons) as PNG images. The best part is the provided shell script, but you can also use it's functionality directly in your (probably awesome) Python project.

There's also font-awesome-to-png script for backwards compatibility with the first <https://github.com/odyniec/font-awesome-to-png>__ iteration of the concept.

Installation

Make sure you have required packages for Pillow installation <https://pillow.readthedocs.org/en/latest/installation.html>__.

From PyPI (recommended):

::

$ pip install icon_font_to_png

With git clone:

.. code:: shell

$ 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

OS X


As reported
`here <https://github.com/Pythonity/icon-font-to-png/issues/2#issuecomment-197068427>`__,
to install it on OS X:

::

    $ pip install icon_font_to_png --ignore-installed six

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         color name or hex value (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

Export all icons in blue, but using it's hex value:

::

    $ icon-font-to-png --css font-awesome.css --ttf fontawesome-webfont.ttf --color '#0000ff' ALL

Or you can use ``font-awesome-to-png``, without css and ttf arguments:

::

    $ font-awesome-to-png ALL

API
---

You can use ``IconFont`` (and ``IconFontDownloader`` for that matter)
directly inside your Python project. There's no proper documentation as
of now, but the code is commented and *should* be pretty straightforward
to use.

That said - feel free to ask me via
`email <mailto:pawel.ad@gmail.com>`__ or [GitHub issues][github add
issue] if anything is unclear.

Tests
-----

Package was tested with the help of ``py.test`` and ``tox`` on Python
2.7, 3.4, 3.5 and 3.6 (see ``tox.ini``).

Code coverage is available at
`Coveralls <https://coveralls.io/github/Pythonity/icon-font-to-png>`__.

To run tests yourself you need to run ``tox`` inside the repository:

.. code:: shell

    $ pip install -r requirements/dev.txt
    $ tox

Contributions
-------------

Package source code is available at
`GitHub <https://github.com/Pythonity/icon-font-to-png>`__.

Feel free to use, ask, fork, star, report bugs, fix them, suggest
enhancements, add functionality and point out any mistakes. Thanks!

Authors
-------

Developed and maintained by `Pythonity <http://pythonity.com/>`__.

Original version by `Michał
Wojciechowski <https://github.com/odyniec>`__, refactored by `Paweł
Adamczak <https://github.com/pawelad>`__.

.. |Build status| image:: https://img.shields.io/travis/Pythonity/icon-font-to-png.svg
   :target: https://travis-ci.org/Pythonity/icon-font-to-png
.. |Test coverage| image:: https://img.shields.io/coveralls/Pythonity/icon-font-to-png.svg
   :target: https://coveralls.io/github/Pythonity/icon-font-to-png
.. |PyPI version| image:: https://img.shields.io/pypi/v/icon_font_to_png.svg
   :target: https://pypi.python.org/pypi/icon_font_to_png
.. |Python versions| image:: https://img.shields.io/pypi/pyversions/icon_font_to_png.svg
   :target: https://pypi.python.org/pypi/icon_font_to_png
.. |License| image:: https://img.shields.io/github/license/Pythonity/icon-font-to-png.svg
   :target: https://github.com/Pythonity/icon-font-to-png/blob/master/LICENSE


Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc