https://github.com/knifa/max7456-font-tools
Some Python scripts for working with MAX7456 fonts.
https://github.com/knifa/max7456-font-tools
arduino betaflight max7456 minimosd osd
Last synced: 3 months ago
JSON representation
Some Python scripts for working with MAX7456 fonts.
- Host: GitHub
- URL: https://github.com/knifa/max7456-font-tools
- Owner: Knifa
- License: mit
- Created: 2017-08-25T01:19:26.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-25T01:24:39.000Z (almost 9 years ago)
- Last Synced: 2025-04-06T21:32:59.481Z (about 1 year ago)
- Topics: arduino, betaflight, max7456, minimosd, osd
- Language: Python
- Homepage:
- Size: 2.93 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# MAX7456 Font Tools
A hacky set of Python tools for working with MAX7456 fonts (.mcm) using Pillow.
Tested on Python 3.6.1.
## Setup
1. Clone the repository.
2. Install requirements (just Pillow) with `pip install -r requirements.txt`.
## unpack_tiles.py
Splits an input image up into seperate image tiles. Intention is to be used to
generate tiles for a logo, then passed into `max.py`.
### Usage
`./unpack_tiles.py [--start-index I] width height filename`
- `--start-index I`: number to start file indexing from (defaults to 0)
- `width`: width of tiles (defaults to 12 for MAX7456)
- `height`: height of tiles (defaults to 18 for MAX7456)
- `filename`: image to unpack.
The script will output seperate images `I.png` to `I+N.png` in the current
directory.
### Notes
- Images must be divisible by tile width and height.
- Indexing starts from top left of image, sequential, row by row.
- Betaflight OSD starts logos from 160 (at time of writing).
## max.py
Packs or unpacks a MAX7456 font (`.mcm`).
### Usage
`./max.py (--pack | --unpack) filename`
- `--pack`: packs images in current directory into the font file.
- `--unpack`: unpacks images from font into the current directory.
- `filename`: font to pack/unpack.
#### Packing
On packing, the script will grab images `0.png` to `255.png` in the current
directory and pack them from the font file.
Any color other than black or white will be interpreted as transparent.
#### Unpacking
On unpacking, the script will spit out images from `0.png` to `255.png` into
the current directory from the font file.
Transparent pixels are represented by green.
### Notes
- RGB images are expected on packing, and are exported on unpacking.
## License
These scripts are licensed under the MIT License. See `LICENSE.md` for details.