feat: add png-exr-alpha float PNG false-unpremul witness#69
Merged
Conversation
AI float scratch buffers routinely die on Image.save() to PNG — Blender writes RGBA16 and unpremultiplies as if associated-alpha, clamping dark straight values at low alpha to white (closed-form err 0.98). Ship the contract beside OpenEXR and byte-PNG controls so it cannot quietly drift. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
examples/png-exr-alpha/witnessing thatfloat_buffer=TrueImage.save()to PNG writes RGBA16 and false-unpremultiplies as if associated-alpha, clamping straight-authored dark values at low alpha to white (closed-form RGB err 0.98 at(0.02, a=1/255)).3e-8), byte→PNG straight RGBA8, andEXR color_mode='RGB'dropping alpha to opaque.API contract
Float images author straight RGBA via
pixels. PNG save treats the buffer as associated, doesc/a+ clamp, stores 16-bit. Mid-tones/darks withc > areload as white.Falsification
Temporarily swapped the float→PNG model check to the byte straight-alpha expecter → exit 6, residual 0.9803922. Restored; check passes again.
Visual
Dual easel (PNG-mangled vs EXR-clean). Contact-sheet compared against
armature-bend,damped-track-aim,bmesh-gear. EEVEE render locally on Blender 5.1.1.Test plan
blender-smokeCI (4.5 not installed locally; 4.4.3 informal pass only — not a 4.5 substitute)--outputrender + hero/preview webppython scripts/build_gallery.py; inspected generateddocs/gallery/index.html+ detail<img alt>/ witnesses (no dup/truncation artifacts onq16(...))Made with Cursor