ImageGen soft matte erases opaque foreground pixels beyond --opaque-threshold
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 80/100
Research direction
The soft-matte alpha is computed in codex-rs/skills/src/assets/samples/imagegen/scripts/remove_chroma_key.py around lines 210-222, where the distance alpha and color-dominance alpha are combined with min(). Run the reproduction from the issue to confirm the alpha values for green, turquoise and red. Done means the turquoise stripe stays at alpha 255 with soft matte on, the green background is transparent, and the transparent count is 900, with a regression test for a saturated foreground outside the transition band.
Written by the indexing model from the issue text.
Description
The ImageGen skill's chroma-key helper removes an entire turquoise foreground region when keying out green. The foreground is 224 units from the key by the helper's max-channel distance. With --opaque-threshold 96, the help text says it should remain fully opaque.
Reproduction From the repository root at de83e7674a69b9ae18544dd1fbf53f31bfe8c640, on Linux x86_64 with Python 3.12.14 and Pillow 13.0.0. This creates three solid stripes so the result can be checked without visual judgment.
d=$(mktemp -d)
python3 - "$d/input.png" <<'PY'
import sys
from PIL import Image
im = Image.new("RGB", (90, 30), "#00ff00")
im.paste("#00ffe0", (30, 0, 60, 30))
im.paste("#ff0000", (60, 0, 90, 30))
im.save(sys.argv[1])
PY
python3 codex-rs/skills/src/assets/samples/imagegen/scripts/remove_chroma_key.py \
--input "$d/input.png" --out "$d/soft.png" --key-color '#00ff00' \
--soft-matte --opaque-threshold 96
python3 - "$d/soft.png" <<'PY'
import sys
from PIL import Image
im = Image.open(sys.argv[1])
print([im.getpixel((x, 15))[3] for x in (15, 45, 75)])
PY
Observed The alpha values for green, turquoise, and red are [0, 0, 255]. The helper reports 1800/2700 transparent pixels. With the same input and plain hard keying, the values are [0, 255, 255].
Expected With soft matte enabled, the green background is transparent and both foreground stripes stay opaque. Only 900 pixels should be transparent.
Suggested fix Enforce the upper distance threshold before applying the color-dominance adjustment. Currently the minimum of the distance and dominance alphas can be zero even after the distance calculation returned 255. A saturated foreground outside the transition band would make a regression test. Alpha calculation
- Dominant language
- Rust
- Stars
- 135k
- Forks
- 21.4k
- Avg merge
- 1m
- Merged PRs (30d)
- 997
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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 openai/codex
-
ImageGen generate-batch aborts valid JSONL jobs containing a Unicode line separator in poster textOpenbug imagen skills
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
gitDiffToRemote fails on an unpushed topic branch when the remote default branch contains a slashOpenapp-server bug CLI
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
bug CLI
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
bug CLI skills
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
bug CLI tool-calls
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
Similar issues
-
bug UI
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
wardian-app/Wardian#1746 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
jlcodes99/cockpit-tools#3125 ·
Maintainers usually reply within 2 days
-
bug user-sprint
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Vondor/KassenSturz#967 ·
Maintainers usually reply within 1 day
-
area/ci
Difficulty 1/5 Under an hour Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
[BUG] Incremental sync warns "no stored highest_uid" on every round for folders with no new mailOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
rustmailer/bichon#411 ·