blend_modes
blend_modes copied to clipboard
Wrong transparency results in some specific cases
In some specific cases I got unexpected behaviours with transparency.
To replicate the problem you can use the attached images (please note that images are 10x10 to better debug the code):

and the following code:
import blend_modes
fgr = cv2.imread("fgr.png", cv2.IMREAD_UNCHANGED)
bgr = cv2.imread("bgr.png", cv2.IMREAD_UNCHANGED)
res = blend_modes.multiply(bgr.astype(float), fgr.astype(float), opacity=1.).astype("uint8")
cv2.imwrite("res.png", res)
You will see that expected result (attached), that has been built with PS, is slightly different than the code result.

This problem is happening not only with multiply but also with other modes (normal works properly).
Is it maybe related to this?