Open flrs opened 5 years ago
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
@AeroDEmi unfortunately no. I do not have resources to implement this change and I am looking for a community member to step up and help maintaining the project. See here.
@json7 I would suggest you to add a new issue so the community can work on this question separately.
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 https://github.com/flrs/blend_modes/issues/6#issuecomment-453372593_