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

Saturate whites for color dodge #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mysteryDate
Copy link

@mysteryDate mysteryDate commented Feb 28, 2018

According to https://en.wikipedia.org/wiki/Blend_modes#Dodge_and_burn

Blending any color with white gives white. Blending with black does not change the image. The operation is not invertible due to possible clipping of highlights.

As was written, with an equality, blending with values > 1 produces strange results:

Base:
screen shot 2018-02-28 at 09 54 37

Blend:
screen shot 2018-02-28 at 09 54 45
Which is a procedurally generated sun that has many r and g values > 1.

Result (with opacity = 0.5):
screen shot 2018-02-28 at 09 54 14

Replacing the conditional in line 2 with: blend>=1.0:
screen shot 2018-02-28 at 09 55 25

Which is kinda cool, but still probably not what is wanted, as the color should saturate at white and opacity = 0.5 here means that at most a 50% grey should be added from the blended image. Finally with line 2 reading (blend>1.0)?1.0:... :
screen shot 2018-02-28 at 09 55 34

Which is how I believe the blending would work in photo editing software.

@mysteryDate
Copy link
Author

There are possibly other blend modes in this repo that don't account for values > 1, I can fix those two if you'd like. That is, if you agree that values > 1 should be handled.

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