Allow indexed PLTEs with 4N colors to specify N embedded GBC palettes
- Dominant language
- C++
- Stars
- 1.6k
- Forks
- 193
- Avg merge
- 22h 17m
- Merged PRs (30d)
- 26
Description
Say I have an indexed image with 16 input colors, and I want each input color to be reduced modulo `2**bit_depth` in the output. For example, input colors 1, 5, 9, and 13 would become 1 in the output. I have relied on this behavior of a different tool in a previous project targeting an 8-bit console with 2bpp character graphics. Would it be reasonable to add `-c modulo`, which is `-c embedded` without the fatal error on an out-of-bounds color value?
If there's no serious objection, I plan to attempt the PR myself.
Test case: `testcase1.png` has 8 colors and uses all 8. `testcase2.png` has 8 colors and uses the first 4; all color index values have been reduced modulo 4. `testcase3.png` has 4 colors. Converting them with `-c modulo` should produce the same character data as converting `testcase3.png` with `-c embedded`. (I've used two of them as test cases for #1064 as well.)



Contributor guide
Research direction
Start at the CLI handling for -c embedded and the tests using testcase1.png, testcase2.png, and testcase3.png. Verify that -c modulo accepts 4N-color indexed PLTEs, reduces indices modulo the bit depth, and produces the same character data as -c embedded for testcase3.png.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100