blend_modes icon indicating copy to clipboard operation
blend_modes copied to clipboard

Wrong transparency results in some specific cases

Open nico00 opened this issue 4 years ago • 1 comments

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): bgr fgr

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.

code_result expected_result

This problem is happening not only with multiply but also with other modes (normal works properly).

nico00 avatar Jun 21 '21 14:06 nico00

Is it maybe related to this?

j05u3 avatar Aug 19 '21 01:08 j05u3