Skip to main content

pillow_zx_spectrum

Jetpac Treasure Island Dizzy Daley Thompson's Decathlon Jet Set Willy II

Pillow loaders for ZX Spectrum loading screens, extracted from tape, disk and snapshot files in the wild.

Open a tape, disk image, or snapshot with Image.open(...) and Pillow gives you a 256×192 RGB image with the original Spectrum colours. Files that contain multiple screens (multi-load games, multi-side disks) expose them as Pillow frames via seek() / n_frames.

Install

pip install pillow_zx_spectrum

Command line

Open a Spectrum image up in your image viewer, or write a found frame to disk:

zx-screen "Glug Glug (1984)(CRL).tap"
zx-screen "Moonwalker (Erbe).dsk" --frame 1 -o moonwalker.png

Usage

from PIL import Image
import pillow_zx_spectrum  # registers the plugins on import

img = Image.open("Glug Glug (1984)(CRL).tap")
img.save("loading-screen.png")
print(img.size)                   # (256, 192)
print(img.info["pixel_aspect_ratio"])  # (1, 1)

Multi-screen containers (disks, multi-load tapes) expose every screen they hold. Iterate with the stock Pillow helper:

from PIL import ImageSequence

img = Image.open("Moonwalker (Erbe).dsk")
print(img.n_frames)  # e.g. 2
for i, frame in enumerate(ImageSequence.Iterator(img)):
    frame.save(f"moonwalker.{i}.png")

How it works

A file becomes a stream of (addr, body, name, kind) events, and if one is the same size as a SCREEN$, or it overlaps the $4000-$5AFF graphics region, then you'll get an image for each one (assuming it looks sensible).

Supported formats

Most of them tbh:

Tape

Ext Format Notes
.tap TAP Plain ROM-loader block stream
.tzx TZX Versioned tape with timing/meta blocks; we extract from standard (0x10) and turbo-speed (0x11) data blocks. Custom-loader pure-data blocks (SpeedLock / BleepLoad / Alkatraz, block 0x14) are skipped — they need per-protection decoders.
.scr SCREEN$ Raw 6912-byte screen dump

Disk

Ext Format Notes
.dsk CPC DSK Spectrum +3 / Amstrad CPC, both standard and "Extended" variants. CP/M file system parsed (handles fragmented allocation). Auto-detects single/double-sided and various reserved-track conventions.
.scl TR-DOS packed "SINCLAIR" magic, compact distribution format used in Russian-speaking scene
.trd TR-DOS raw Sector-by-sector TR-DOS floppy dump; tolerant of truncated images
.mgt DISCiPLE / +D Side-interleaved 80-track disk for the MGT DISCiPLE & +D interfaces. CODE/SCREEN$ files reassembled by following the per-sector chain.
.d40, .d80 Didaktik MDOS Czechoslovak Didaktik D40/D80 floppy. MDOS file system with non-standard FAT12 packing (the 12-bit entries' high nibbles are byte-swapped relative to MS FAT12). Auto-detects geometry from the boot sector "SDOS" marker. Most TOSEC Czech games use packed loaders so plain SCREEN$ extraction is rare.

Microdrive

Ext Format Notes
.mdr Microdrive cart Sector-by-sector dump of a Spectrum Microdrive cartridge (543-byte sectors with mod-255 checksums). Files reconstructed by gathering all records belonging to a filename and stripping the inline 9-byte header. PRINT# files are not handled.

Snapshot

Ext Format Notes
.sna SNA Classic 48K (49179 bytes) / 128K (131103 bytes) snapshot
.z80 Z80 Gerton Lunter format (v1, v2, v3); 48K and 128K with bank decompression
.szx SZX / ZX-State Spectaculator's modern chunked snapshot, with zlib-compressed RAM pages
.slt SLT "Super Level Loader" — a Z80 snapshot with a table of additional screens (each becomes a frame)

For 128K snapshots the shadow screen (bank 7) might be exposed as an extra frame.

Unsupported

You'll get UnidentifiedImageErrors for sampled audio tapes, custom loaders, copy protected games and other weird things. It doesn't run any Z80 machine code so programmatically made screens aren't decoded.

License

WTFPL with one additional clause:

  1. Don't blame me.

Do what you like, but you're to blame.

Release files for pillow-zx-spectrum 0.2.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 pillow-zx-spectrum 0.2.0
File Size Uploaded
pillow_zx_spectrum-0.2.0.tar.gz 40.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pillow-zx-spectrum 0.2.0
File Interpreter ABI Platform
pillow_zx_spectrum-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 96.1 kB

Release files / pillow_zx_spectrum-0.2.0.tar.gz

Download URL pillow_zx_spectrum-0.2.0.tar.gz
Size 40.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8951d228ec28d2511a8aee959e6d14831ac2a07a6223e2beb51be3688df96d88
BLAKE2b-256 checksum
How to use checksums
5f0e8df6a5f8a2c94499888be31f19fda94d432f2008185f9c2884af376738bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

Release files / pillow_zx_spectrum-0.2.0-py3-none-any.whl

Download URL pillow_zx_spectrum-0.2.0-py3-none-any.whl
Size 55.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f92201ca45cdb3fe79a14de406153e9e36f3465cc075244abc7ef1b9cffe7e2f
BLAKE2b-256 checksum
How to use checksums
282ef7d790a90cd79e1ca06ab8e2a42b3f65109cf0770fca04f9df00782239d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

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