Convert FontAwesome icons to PNG format
Project description
FontAwesome Converter
๐ Overview
FontAwesome Converter is a Python tool that allows you to convert FontAwesome icons to PNG format with flexible options. The tool supports both SVG-based and font-based rendering methods and can generate icons in multiple sizes simultaneously.
โจ Features
- ๐จ Multiple Rendering Methods: Convert using SVG or font-based rendering
- ๐ Flexible Size Options: Generate icons in multiple preset sizes (16px to 512px)
- ๐ฃ Style Support: Convert icons in solid, regular, or brands styles
- ๐ญ Color Customization: Apply custom colors to your icons
- ๐ Organized Output: Automatically organizes icons by size in separate folders
- ๐ Batch Processing: Convert individual icons or the entire icon set
- ๐ Logging Control: Adjustable verbosity with multiple log levels
๐ Installation
From PyPI (Recommended)
pip install fontawesome-converter
From Source
# Clone the repository
git clone https://github.com/SakuraPuare/fontawesome-converter.git
cd fontawesome-converter
# Install the package
pip install -e .
๐ Usage
๐ FontAwesome Path Requirements
The /path/to/fontawesome
argument should point to the extracted FontAwesome package directory downloaded from fontawesome.com/download. After downloading the ZIP file, extract it and use the path to the extracted directory.
Expected Directory Structure
fontawesome-directory/
โโโ css/
โโโ js/
โโโ svgs/
โ โโโ solid/
โ โโโ regular/
โ โโโ brands/
โโโ webfonts/
โโโ metadata/
โโโ icons.json
Important notes:
- Make sure to use the path to the extracted directory, not the ZIP file
- The tool needs access to
svgs/
directory for SVG rendering andwebfonts/
for font rendering- The
metadata/icons.json
file is required for both rendering methods- Both Free and Pro versions of FontAwesome are supported
๐ป Command Line Interface
Convert a single icon:
fa-convert convert arrow-right /path/to/fontawesome --style solid --size 512 --color "#FF0000"
Convert all icons:
fa-convert convert-all /path/to/fontawesome --style solid --size 512
โ๏ธ Options
Option | Description |
---|---|
--style |
Icon style (solid, regular, brands) |
--size |
Maximum output size in pixels (will generate all standard sizes up to this value) |
--color |
Color for the icon (as hex code) |
--render-method |
Method to use for rendering (svg or font) |
--output-dir |
Directory to save the outputs |
--log-level |
Set logging verbosity (DEBUG, INFO, WARNING, ERROR, CRITICAL) |
๐ Python API
from fontawesome_converter import FontAwesomeConverter
# Initialize converter
converter = FontAwesomeConverter("/path/to/fontawesome")
# Convert a single icon
converter.convert_svg("arrow-right", style="solid", size=512, color="#FF0000")
# Convert all icons
converter.convert_all(style="solid", size=512, render_method="svg")
๐ Output Structure
Converted icons are organized in the following structure:
View Output Directory Structure
output/
16px/
icon1_solid.png
icon2_regular.png
...
24px/
icon1_solid.png
icon2_regular.png
...
32px/
...
48px/
...
64px/
...
128px/
...
256px/
...
512px/
...
๐ Examples
Basic Usage
Convert an icon to multiple sizes (maximum 512px):
fa-convert convert arrow-right /path/to/fontawesome
Custom Colors
Convert all "solid" style icons to blue PNGs:
fa-convert convert-all /path/to/fontawesome --style solid --color "#0000FF"
Verbose Logging
Adjust log level for detailed information:
fa-convert --log-level DEBUG convert arrow-right /path/to/fontawesome
๐ง Requirements
- Python 3.10+
- FontAwesome files (can be downloaded from FontAwesome)
- Dependencies:
- cairosvg - for SVG rendering
- Pillow - for image processing
- loguru - for enhanced logging
- click - for CLI interface
- tqdm - for progress bars
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
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 fontawesome_converter-1.1.0.tar.gz
.
File metadata
- Download URL: fontawesome_converter-1.1.0.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
76a26c931c8f387feb885df9743bee243d210f6eb41737c970fc1a4cdb9f0dc2
|
|
MD5 |
2d941b2ca308a0327161413f7a8c34e5
|
|
BLAKE2b-256 |
cbe302012f5055c96ddfd1ba805d2a1f21f4e66dddeed3bd32544f14aee7b268
|
Provenance
The following attestation bundles were made for fontawesome_converter-1.1.0.tar.gz
:
Publisher:
python-publish.yml
on SakuraPuare/fontawesome-converter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
fontawesome_converter-1.1.0.tar.gz
-
Subject digest:
76a26c931c8f387feb885df9743bee243d210f6eb41737c970fc1a4cdb9f0dc2
- Sigstore transparency entry: 186567042
- Sigstore integration time:
-
Permalink:
SakuraPuare/fontawesome-converter@b9402c0f5fb7e12b87f272b7d714a00d5f3e9cbb
-
Branch / Tag:
refs/tags/v1.1.0
- Owner: https://github.com/SakuraPuare
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
python-publish.yml@b9402c0f5fb7e12b87f272b7d714a00d5f3e9cbb
-
Trigger Event:
release
-
Statement type:
File details
Details for the file fontawesome_converter-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: fontawesome_converter-1.1.0-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
3cdd094cd7bf308ff2a56afcc7d765ef90e3852e7bda28f23a86b4abf280613d
|
|
MD5 |
a097ee87ffa76e4a30bdb660446e5eb4
|
|
BLAKE2b-256 |
4fc4059167d6152f66b465fd878239ba49f7ebc49c47d7b0a9093fb51d2e8f95
|
Provenance
The following attestation bundles were made for fontawesome_converter-1.1.0-py3-none-any.whl
:
Publisher:
python-publish.yml
on SakuraPuare/fontawesome-converter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
fontawesome_converter-1.1.0-py3-none-any.whl
-
Subject digest:
3cdd094cd7bf308ff2a56afcc7d765ef90e3852e7bda28f23a86b4abf280613d
- Sigstore transparency entry: 186567043
- Sigstore integration time:
-
Permalink:
SakuraPuare/fontawesome-converter@b9402c0f5fb7e12b87f272b7d714a00d5f3e9cbb
-
Branch / Tag:
refs/tags/v1.1.0
- Owner: https://github.com/SakuraPuare
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
python-publish.yml@b9402c0f5fb7e12b87f272b7d714a00d5f3e9cbb
-
Trigger Event:
release
-
Statement type: