Skip to content

Python package to produce bitmap images containing text for use with small, low-resolution displays such as Papirus e-paper liquid-crystal displays

Notifications You must be signed in to change notification settings

billtubbs/text-bitmaps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

text-bitmaps

Python package to produce bitmap images containing text for use with small, low-resolution displays such as Papirus e-paper liquid-crystal displays.

Below is photo of a 200 x 96 pixel Papirus e-paper display mounted on a Raspberry PI Zero showing an image generated by this script (see demo below).

The font is based on the Mullard SAA5050 chip (dated July 1982) that was used to display text-based information on TV screens. Many thanks to bjh21 for providing the raw data for the original fonts as well as a large collection of additional unicode characters.

Bitmaps for the following character sets are included here:

ASCII

  • fixed
  • proportional

Unicode - Basic Latin (ASCII) and Latin-1 Supplement

  • fixed
  • proportional

The proportional bitmaps allows more characters per line because certain characters ('i', 'j', etc) have been trimmed.

Installation

To install this package, first clone or download this repository, then go to the main folder on your computer and run the following command in your terminal:

pip install -e .

This will install this package in your current environment.

Basic Usage

There are two functions.

import bitmaps

img = bitmaps.get_char_image(65)
img.show()

Produces the following image:

text_to_display = "Take this kiss upon the brow!\n" \
                  "And, in parting from you now,\n" \
                  "Thus much let me avow:\n" \
                  "You are not wrong, who deem\n" \
                  "That my days have been a dream;\n" \
                  "Yet if hope has flown away\n" \
                  "In a night, or in a day,\n" \
                  "In a vision, or in none,\n" \
                  "Is it therefore the less gone?\n" \
                  "All that we see or seem\n" \
                  "Is but a dream within a dream."

img, char_count = bitmaps.display_text_prop(text_to_display)
img.show()
img.save("eapoe2.bmp")

print("{} of {} characters displayed".format(char_count, len(text_to_display)))

Produces:

251 of 305 characters displayed

There are also double-sized versions of all the bitmaps.

text_to_display = [chr(c) for c in range(32, 128)]

img, char_count = bitmaps.display_text_prop(text_to_display, display_size=(200, 96), char_size=2)
img.show()
img.save("large_font.bmp")

print("{} of {} characters displayed".format(char_count, len(text_to_display)))

Produces:

72 of 96 characters displayed

Related projects

About

Python package to produce bitmap images containing text for use with small, low-resolution displays such as Papirus e-paper liquid-crystal displays

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages