Skip to content

pngio.py: MicroPython's pngio, on CPython over Pillow - #125

Merged
bdbarnett merged 2 commits into
mainfrom
pngio-pillow
Oct 7, 2026
Merged

bdbarnett merged 2 commits into
mainfrom
pngio-pillow

Conversation

@bdbarnett

Copy link
Copy Markdown
Contributor

import pngio now works the same on CPython as on MicroPython. MicroPython builds carry the C module (PyDevices/micropython-pydevices, modules/pngio). On CPython, utils/pngio.py gives the same PngEncoder / PngDecoder API over Pillow, so an app doesn't know which runtime it's on (Brad, 2026-10-07). It ships in pydevices-desktop, like everything in utils/. Without Pillow, the import says pip install pillow.

micropython-pydevices' modules/pngio/tests/test_pngio.py runs unchanged against this file. On python (Linux) and python.exe (Windows) it gives exact RGB565 round trips, the formats, the stride and placed decode, and every error, raised where the C module raises it. tests/test_pngio.py here covers the CPython-only parts, and skips its round trip when Pillow isn't installed, as in this repo's unittest job.

@bdbarnett
bdbarnett merged commit 08f6eab into main Oct 7, 2026
3 checks passed
@bdbarnett
bdbarnett deleted the pngio-pillow branch October 7, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant