Skip to content

Fix 16-bit RGB PNG transparency key matching - #10365

Open
Zhuyuyangyy wants to merge 1 commit into
python-pillow:mainfrom
Zhuyuyangyy:fix/16bit-rgb-trns
Open

Zhuyuyangyy wants to merge 1 commit into
python-pillow:mainfrom
Zhuyuyangyy:fix/16bit-rgb-trns

Conversation

@Zhuyuyangyy

Copy link
Copy Markdown

Fixes #10330

Changes proposed in this pull request:

  • Open 16-bit RGB PNGs with a tRNS key in RGBA mode and preserve the full RGB key through the PNG ZIP decoder. Match original 16-bit samples before reducing channel precision to 8 bits.
  • Add regression tests for exact-key matches, same-high-byte/different-low-byte samples, and low-byte collisions. Exercise all five PNG row filters in both non-interlaced and multi-row Adam7 images.
  • Document the visible RGB-to-RGBA mode change.

Validation (Linux, Python 3.12.3):

  • Editable C-extension build succeeded.
  • python3 selftest.py: 59 passed.
  • python3 -m pytest -q Tests/: 5,364 passed, 447 skipped, 3 xfailed. Skips are for unavailable optional dependencies and platform-specific tests; the xfails are existing expected failures.
  • python3 -m tox -e lint: passed, including Pyroma.
  • python3 -m tox -e mypy: no issues found in 303 source files.

Disclosure: This pull request was prepared with assistance from Cue AI on behalf of the account owner. No independent human review has occurred; the validation above was run locally.

@radarhere radarhere added the 🤖-assisted AI-assisted label Oct 31, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖-assisted AI-assisted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

16-bit PNG tRNS key: convert("RGBA") misses the keyed pixel and makes another transparent

2 participants