Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix alpha bleed #14

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Fix alpha bleed #14

wants to merge 4 commits into from

Conversation

EgoMoose
Copy link

@EgoMoose EgoMoose commented Jan 24, 2025

This PR makes a couple of fixes / adjustments to the alpha bleed algorithm.

  1. It only bleeds one pixel now. See this README for why.
  2. Fully transparent pixels that are not bled into are converted to pure black for better encoding.
  3. Fixes a mistake in the algorithm where pixels could sample neighbors from the same queue cycle.

The first pass iterates over pixels left-to-right, top-to-bottom so this effect naturally impacts pixels that come further along in the iteration (right and bottom). However, due to the order of the neighbor offsets this effect is somewhat muddied. Regardless, pixels should not be sampling their bled neighbors from the same cycle.

Given an input image:
tree

The results go from looking like this (everything fully opaque):
image

To this:
image

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.

1 participant