Repository navigation
Add proof of concept for planar multiband images - #10195
Draft
aclark4life wants to merge 1 commit into
Draft
aclark4life wants to merge 1 commit into
aclark4life wants to merge 1 commit into
Conversation
Private, experimental module for the design proposal in #10189. Stores each band as a single-band core image with per-band metadata, applies band-independent operations per plane, and premultiplies straight alpha when resampling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Refs #10189, #1888.
Changes proposed in this pull request:
PIL._planarmodule as a proof of concept for the planar storage design proposed in Add design proposal for multiband and high bit depth images #10189. It may change or be removed without deprecation, and nothing public changes.PlanarImagestores each band as an existing single-band core image (L,I;16,I,F), with per-band metadata (name, sample type, role: color/alpha/extra), a colorspace and a premultiplied flag.modeis a single generic value,"planar".crop,transpose,resize,rotateandfilterare applied per plane. With straight alpha,resizeandrotatepremultiply color bands first.L,LA,La,RGB,RGBA,RGBa,CMYK,I;16,I,F, ...) convert to and from planar images losslessly.The aim is to test the open questions in #10189 with code before proposing answers.
Findings
I;16has noreduce()and no Gaussian, box, median or unsharp filters;Fhas noBLUR. "No new C code per operation" holds only once these are filled in.FtoI;16conversion clips at 255. Worked around here by converting throughI.RGBaloses precision at low alpha. Compared with premultiplying in floating point, Pillow'sRGBAresize differs by up to 27 levels where alpha is low, and 3–9 where alpha ≥ 128. This supports recording premultiplication as metadata rather than converting around each operation.Not covered yet
Image🤖 Generated with Claude Code