-
Notifications
You must be signed in to change notification settings - Fork 29
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
Add Cython implementation #9
Labels
Comments
Instead of Cython, something like https://numba.pydata.org/ can also be explored for use. |
Any news on the Numba side? |
After I changed to the cython library you provided, the overlay effect was incorrect, which is different from the previous pure Python implementation. Why is this |
@json7 I would suggest you to add a new issue so the community can work on this question separately. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You mentioned that these could be sped up if implemented in Cython. If you're interested, I have done so here, and gotten a pretty good speed improvement:
https://pastebin.com/fAD9avjP
If there're any obvious optimizations that I'm not seeing in the Cython code, feel free to let me know. I have successfully implemented all of Photoshop's blending modes, as well as yours, except the "Darker Color, Lighter Color, Hue, Saturation, Color, and Luminosity" blending modes (from Photoshop). I attempted hue, but couldn't quite figure it out; you'll see remnants of my attempt in the code.
The only implementation difference from yours is that each blend mode function already expects the input image to be divided by 255, and the output image is not multiplied by 255. This makes it easier to blend multiple layers together without unnecessary computation. So you have to do those division and multiplication steps manually before and after blending. They also don't require the input images to have an alpha channel (but it still works if either do).
Originally posted by @JohnTravolski in #6 (comment)
The text was updated successfully, but these errors were encountered: