Skip to main content

sextants

Convert raster images (JPEG, PNG, …) to teletext / viewdata block-mosaic graphics — the 40×25 character page rendered by the SAA5050 and its relatives (BBC Micro Mode 7, Ceefax/Oracle teletext, Prestel viewdata, CEPT videotex).

The name comes from Unicode's own term for the 2×3 sub-pixel mosaic cell these displays draw — the sextants of the "Symbols for Legacy Computing" block (U+1FB00…). Each cell is six sub-pixels sharing a two-colour sub-palette, and a colour change is an in-band control code that costs a whole cell. Encoding an image well is therefore a constrained optimisation, not a simple resample — which is what this library does, row by row, with an optimal dynamic-programming solver.

Attribution

sextants is a derivative work of image2mode7 / image2teletext by Kieran Connell. The conversion algorithm at its heart — the per-row dynamic-programming solver, the sub-pixel error model, and the preprocessing pipeline — is Kieran's work, used here under its MIT licence. This project repackages that code as an installable, src-layout Python library with a split module structure, a Click CLI, and a test suite, and is the basis for further development. Please see LICENSE for the full notice.

Install

uv add sextants           # or: pip install sextants

Optional numba acceleration for the DP solver:

uv add "sextants[fast]"

Library usage

from PIL import Image
from sextants import convert, render_preview

page = convert(Image.open("photo.jpg"), preset="photo")  # 1000-byte teletext page
Path("photo.bin").write_bytes(page)                       # load at &7C00 on a BBC Micro

render_preview(page).save("preview.png")                  # what it looks like on-screen

convert(img, preset=None, **overrides) is the preset-aware entry point; convert_image(...) exposes every knob directly. Presets bundle sensible preprocessing options for common sources:

Preset For
photo Portraits, landscapes, general photos
clean Safe universal default; light denoise + snap for unknown/BBS images
smooth Noisy JPEGs, soft gradients
vivid / graphic / flat Punchy colour, logos/cartoons, bold posterised
retro / art Authentic Ceefax look, hand-crafted teletext-art look
level1 Source is already a Mode 7 / Level 1 teletext image
dark / tv / crt Exposure lift; LCD (PAR 1.2); CRT (PAR 1.22)

Command line

sextants photo.jpg -o photo.bin --preset photo
sextants photo.jpg --preview preview.png --url    # also print an edit.tf URL
sextants --help

The output is a raw 1000-byte page (25 rows × 40 bytes of teletext character codes). It loads directly at &7C00 on a BBC Micro, or paste the --url into edit.tf.

Development

uv sync            # create the environment
uv run pytest      # run the test suite

Licence

MIT — see LICENSE. Original algorithm © 2020 Kieran Connell; packaging and modifications © 2026 Robert Smallshire.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sextants-0.2.0.tar.gz (28.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sextants-0.2.0-py3-none-any.whl (34.6 kB view details)

Uploaded Python 3

File details

Details for the file sextants-0.2.0.tar.gz.

File metadata

  • Download URL: sextants-0.2.0.tar.gz
  • Upload date:
  • Size: 28.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for sextants-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7d8ce71d9a214edabbea01844eaab79f104c58482d294a025913d6ede509836f
MD5 689c1f7f1c267184a7ae1cbe8b298443
BLAKE2b-256 a8e8f2d8fec914c36cb1a460ada302889cdb70e27f162b74665a7f9af2924d25

See more details on using hashes here.

File details

Details for the file sextants-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: sextants-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 34.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for sextants-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c82d513dcb2afdf57dcd396a9c9e1720ad5a176b42e26d2f3567b6ba23664219
MD5 fc9cbcd4dd6d70020ecd508e2fe865b0
BLAKE2b-256 467caaa6fe7f3417c9f3a116960e1b746c830cd8c6395c6361e2a7488c06e132

See more details on using hashes here.

Release history Release notifications | RSS feed

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

This release

0.2.0 This release

2 files

0.1.1

2 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