Skip to main content

A package for reading .bdf files into NumPy arrays.

Project description

.bdf to NumPy

This project takes a .bdf file and turns it into a NumPy Array with an intended use with LED matrix displays. My LED Stock Ticker uses this package. A good list of .bdf files can be found here

Usage

from bdfparse import Font

font = Font('9x18.bdf')

print(font.word('Hi'))

Which outputs:

[[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
 [0 0 1 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0]
 [0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0]
 [0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0]
 [0 0 1 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0]
 [0 0 1 1 1 1 1 1 1 0 0 0 0 0 1 0 0 0]
 [0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0]
 [0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0]
 [0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0]
 [0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0]
 [0 0 1 0 0 0 0 0 1 0 0 0 1 1 1 1 1 0]
 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]]

Or you can use matplotlib to make the output a bit prettier.

import matplotlib.pyplot as plt

plt.imshow(font.word('Anson'))

Example of code output that reads Anson.

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

bdfparse-2019.8.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

bdfparse-2019.8-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file bdfparse-2019.8.tar.gz.

File metadata

  • Download URL: bdfparse-2019.8.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2

File hashes

Hashes for bdfparse-2019.8.tar.gz
Algorithm Hash digest
SHA256 130dfd1afd2dc113431623a982f292dde758e8d988f4bee5ee59e87800f03616
MD5 1a3a8b9c6c35b76d38fda6f62cf23852
BLAKE2b-256 cf93f2823937427a0ef387dd087eae19e5111232c9453b9d478c7ae9fdc016c2

See more details on using hashes here.

File details

Details for the file bdfparse-2019.8-py3-none-any.whl.

File metadata

  • Download URL: bdfparse-2019.8-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2

File hashes

Hashes for bdfparse-2019.8-py3-none-any.whl
Algorithm Hash digest
SHA256 608894693dd8a44950659c09568a471bb3034aa4165f6a4fb35a7537a9e10572
MD5 a42f720edc7a848bbd36f3fbfe975912
BLAKE2b-256 3e1831a211d32fa1961035aa5693e0d1732c8ba56d4bf0c2a7cd0a991b952e78

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