Skip to main content

tottie

Tottie /ˈtɒti/ — Scottish word meaning tiny or very small. A tottie wee library for tottie wee displays.

Tottie is a Python library for rendering images onto 64×64 LED matrix displays. It provides the shared rendering primitives used by homeassistant-idotmatrix and homeassistant-trinity.

What's included

  • tottie.moon — Moon phase renderer. Draws the current moon disc with texture, a direction/altitude ring indicator, and a lunar cycle progress bar across the top edge.
  • tottie.overlay — Pixel-font text overlay. Renders track/artist (or any two lines of text) onto an image using a compact 3×5 bitmap font, with automatic text paging for long strings.
  • tottie.image — Image utilities. Square fit (crop-to-fill or letterbox) at any size, and RGB565 conversion for displays that accept raw pixel data over serial/MQTT.

Installation

pip install tottie

Usage

Moon phase

from tottie import render_moon

img = render_moon(lat="51.5", lon="-0.1", elev=10)
img.save("moon.png")

Set mirror_ew=True (the default) when the display is on a north-facing wall, so the moon rises on the correct side.

Now playing overlay

from PIL import Image
from tottie import apply_now_playing_overlay

img = Image.open("album_art.jpg").convert("RGB").resize((64, 64))
apply_now_playing_overlay(img, track="Astronomy", artist="Blue Oyster Cult")
img.save("now_playing.png")

For animated paging (long track/artist names scroll across multiple frames):

from tottie import render_now_playing_frames

frames = render_now_playing_frames(img, track="A Very Long Track Title Indeed", artist="Artist")
# frames is a list of (PIL.Image, duration_ms) pairs

Both functions accept optional dim and position parameters:

  • dim (float, default 0.5) — how much of the original image shows through the text background. 0.0 = solid black, 1.0 = no darkening.
  • position ("top" or "bottom", default "top") — where the text block is placed on the image.
apply_now_playing_overlay(img, track="Astronomy", artist="Blue Oyster Cult", dim=0.7, position="bottom")
render_now_playing_frames(img, track="...", artist="...", dim=0.7, position="bottom")

Image utilities

from PIL import Image
from tottie import crop_and_resize, to_rgb565

img = Image.open("photo.jpg").convert("RGB")
small = crop_and_resize(img, size=64)   # centre-crop square, resize to 64×64
raw = to_rgb565(small)                  # bytes ready to publish over MQTT

crop_and_resize accepts a fit argument:

  • fit="cover" (default) — crop to a square then resize. Pixels outside the crop are discarded. Use anchor="top_left" etc. to bias the crop.
  • fit="contain" — letterbox: scale the whole image to fit, padding the short axis with bg (default black). Preserves the entire source image, good for wide photos like aircraft shots.
letterboxed = crop_and_resize(img, size=64, fit="contain")

Requirements

  • Python 3.11+
  • Pillow
  • ephem (for moon rendering)

Licence

MIT

Release files for tottie 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tottie 0.6.0
File Size Uploaded
tottie-0.6.0.tar.gz 41.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tottie 0.6.0
File Interpreter ABI Platform
tottie-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 53.3 kB

Release files / tottie-0.6.0.tar.gz

Download URL tottie-0.6.0.tar.gz
Size 41.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4931fa75c3bc5aa5d53c53c7ab1416697c66b83af68c3acc6cd9d56f5a7599dd
BLAKE2b-256 checksum
How to use checksums
319894344524dd0eaada625bf32a00835b366a90f365c2f9b65de26f3b877cae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 17, 2026.

Transparency log

Release files / tottie-0.6.0-py3-none-any.whl

Download URL tottie-0.6.0-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ade5e4acbe9c15d269faca0664629d7d67b05aed56a43dc9c45491a91207c01
BLAKE2b-256 checksum
How to use checksums
ae5302d63bd2d63ac1e94f142cd7ecacdaafc751576c6065058325d7947f5b47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page