Skip to content

fix: threshold on blue instead of alpha in pngToBmp - #94

Open
arxigen wants to merge 1 commit into
yashlamba:mainfrom
arxigen:fix/pngtobmp-blue-channel
Open

arxigen wants to merge 1 commit into
yashlamba:mainfrom
arxigen:fix/pngtobmp-blue-channel

Conversation

@arxigen

@arxigen arxigen commented Oct 26, 2026

Copy link
Copy Markdown

Fixes #92

pngToBmp thresholded on R, G and alpha instead of R, G and B. Transparent white pixels (255, 255, 255, 0) were classified as ink, and bright low-blue strokes such as a yellow pen (255, 255, 0, 255) were dropped as background. This changes the check to pix[2].

Added test_pngToBmp_threshold to tests/test_pngtosvg.py. It covers opaque white, transparent white, black and yellow pixels, and it fails without the fix. black --check . passes. I couldn't run the potrace/fontforge-dependent tests locally because neither tool is installed here; they fail the same way on unmodified main.

pngToBmp checked R, G and A against the threshold, so transparent white
pixels were turned into ink and bright low-blue strokes (e.g. a yellow
pen) were dropped as background. Check R, G and B instead.

Fixes yashlamba#92

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: pngToBmp threshold checks alpha instead of blue channel (pngtosvg.py:73)

1 participant