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

Implement Adobe-Style Overlay #8

Closed
flrs opened this issue Mar 4, 2019 · 3 comments
Closed

Implement Adobe-Style Overlay #8

flrs opened this issue Mar 4, 2019 · 3 comments
Assignees

Comments

@flrs
Copy link
Owner

flrs commented Mar 4, 2019

I took a look at Wikipedia's implementation of Overlay and used your code as a basis to implement it. For example, given your code, in the overlay function definition, if I replace:
comp = img_in[:,:,:3] * (img_in[:,:,:3] + (2 * img_layer[:,:,:3]) * (1 - img_in[:,:,:3]))

with (using the Wikipedia formula):

a = img_in[:,:,:3]
b = img_layer[:,:,:3]
comp = np.less(a, 0.5)*(2*a*b) + np.greater_equal(a, 0.5)*(1 - (2*(1 - a)*(1 - b)))

Then the overlay blending mode gives a result that is indeed different from Soft Light and looks just like the results that After Effects gives me. For my purposes, this is the version of Overlay that I prefer, even if it's not what GIMP uses.

Originally posted by @JohnTravolski in #6 (comment)

@flrs flrs self-assigned this Mar 4, 2019
@flrs
Copy link
Owner Author

flrs commented Mar 4, 2019

@JohnTravolski came up with the code above. Now, the next step is to implement and test it.

@flrs
Copy link
Owner Author

flrs commented Mar 7, 2019

@JohnTravolski, I am working on implementing your code right now. Can you provide a 640px square PNG test image for your overlay function? Unfortunately I do not have the required licenses for the Adobe products. The way to do produce the test image is to use a 50% overlay blend of layer.png onto orig.png and then export it as a PNG.

@flrs flrs assigned flrs and unassigned flrs Mar 7, 2019
flrs pushed a commit that referenced this issue Mar 10, 2019
This commit changes the overlay method. Previously,
overlay was identical to soft light. This behavior
is present in some GIMP versions. Now, the overlay
method resembles the behavior known from Adobe
products. This commit closes issue #8.
@flrs
Copy link
Owner Author

flrs commented Mar 10, 2019

@JohnTravolski, I am working on implementing your code right now. Can you provide a 640px square PNG test image for your overlay function? Unfortunately I do not have the required licenses for the Adobe products. The way to do produce the test image is to use a 50% overlay blend of layer.png onto orig.png and then export it as a PNG.

I have resolved this and added the picture for testing.

Also, version 2.0.1 was just released and it implements the Adobe-style overlay.

@flrs flrs closed this as completed Mar 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant