Avoid padding indexed PNG palettes
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- python
- Domain
- computer-graphics
Research direction
Start by tracing Pillow’s PNG save path for the bits=4 case and the code that emits the PLTE chunk. Check existing PNG save tests, then verify that an opt-out produces a five-entry palette while the default remains padded and existing reads continue to work.
Written by the indexing model from the issue text.
Description
Hi.
Just a small feature request. Kind of niche use case so let me know if this is out-of-scope for Pillow.
Basically I'd like to save a PNG with bits=4 but with exactly 5 entries in the palette array. Currently, Pillow writes a 16-entry PLTE chunk regardless of the actual number of palette entries.
Could we imagine a small option such as palette_padding=False (default to True for retro-compatibility) to disable padding?
Note that this is permitted by the PNG specs and that Pillow reads these image well.
- Dominant language
- Python
- Stars
- 13.8k
- Forks
- 2.5k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 91
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from python-pillow/Pillow
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
python-pillow/Pillow#9997 · 2 comments ·
-
Documentation Font Rendering Third Party Framework
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
python-pillow/Pillow#9907 · 2 comments ·
-
Documentation
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
python-pillow/Pillow#9810 · 2 comments ·
-
License
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
python-pillow/Pillow#9657 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
python-pillow/Pillow#9584 · 1 comment ·
All issues in python-pillow/Pillow
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100