Skip to content

PNG saves go through pngio; remove pygraphics' own encoder - #38

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

bdbarnett merged 2 commits into
mainfrom
png-to-pngio

Conversation

@bdbarnett

Copy link
Copy Markdown
Contributor

Brad's ruling for the media program: PNG comes out of pygraphics and lives in pngio (micropython-pydevices modules/pngio on MicroPython, pydevices-desktop's Pillow wrapper on CPython), so an app saves PNG the same way on both.

This removes encode_png, write_png_file and FrameBuffer.to_png from the pure package and both native bindings, with no compatibility shim. save_image(fb, "x.png") now encodes through pngio, and if pngio isn't installed it raises an ImportError that says what to install. RGB888 framebuffers save as PNG, which also fixes the old path that wrote nothing for them.

Tested here: the pure and native CPython suites pass with pngio from pydevices/utils, and a unix MicroPython built with --modules pygraphics,pngio saves a PNG that decodes back pixel for pixel. This change is meant for the next pygraphics release.

encode_png, write_png_file and FrameBuffer.to_png are gone. save_image writes
PNG through pngio (built into PyDevices MicroPython firmware; pydevices-desktop
over Pillow on CPython) and raises a clear ImportError when it isn't there.
RGB888 framebuffers now save as PNG instead of writing nothing.
@bdbarnett
bdbarnett merged commit c6f43b5 into main Oct 7, 2026
3 checks passed
@bdbarnett
bdbarnett deleted the png-to-pngio branch October 7, 2026 10:47
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