Repository navigation
fix(color): recover numeric palette slots lost to transparency - #91
Merged
Merged
Conversation
Retry only when an occupied raw cluster has no visible pixels, before component cleanup. Keep numeric counts and seed methods unchanged, clean only the final pass, and leave solver input arrays untouched. Add regressions for transparent palettes, cleanup-only losses, unused centroids, empty images and repeated solves. Preserve the original lower-level SVG hash and HTTP profile contracts.
This was referenced Oct 8, 2026
Merged
phil-r
added a commit
that referenced
this pull request
Oct 8, 2026
Retry only when an occupied raw cluster has no visible pixels, before component cleanup. Keep numeric counts and seed methods unchanged, clean only the final pass, and leave solver input arrays untouched. Add regressions for transparent palettes, cleanup-only losses, unused centroids, empty images and repeated solves. Preserve the original lower-level SVG hash and HTTP profile contracts.
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.
Description:
Fix numeric color requests losing a visible color because hidden RGB in transparent pixels consumes a palette slot. Both color profiles retry only when an occupied cluster has no visible pixels before component cleanup. Recovery preserves the numeric count and initialization method, cleans only the final pass, and leaves input arrays unchanged. Cleanup-only losses do not trigger recovery; auto and binary behavior stay unchanged.
This PR includes:
How to run:
docker compose --profile testing run --build --rm test \ python -m pytest vectorizing/tests/test_color_numeric.py \ vectorizing/tests/test_color_configurations.pyValidation: 827 offline tests and all pre-commit hooks passed.
test_integration.py(HTTP/S3/gallery integration) was excluded. Unaffected SVG, RGBA, palette, dimension and bounds captures matched exactly. Visual evidence remains local; no artwork or gallery baselines were uploaded or replaced.Local benchmarks on the reported PNG (M4 Pro, ARM64 Docker/Python 3.11, single-threaded, 5 fresh-process samples plus warmup):
Recovery adds a bounded extra clustering pass. No consistent slowdown was measured on unaffected inputs. Timing excludes decoding, HTTP/S3 and rasterization; production concurrency was not tested.
Checklist (based on PR guidelines):