Skip to content

Wrong transparency results in some specific cases #22

@nico00

Description

@nico00

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions