1

I have image A ( a png) and image B ( a jpg ). image A and B are the same image, with the exception that image B has better resolution of image A because it's passed through a enhancing resolution api. The problem is that since the API returns a jpg, so now image A is png and it preserves its transparent parts, but image B is a jpeg, so the transparent parts become black.

I want to make a new png image that has the transparency of A when needed and the resolution of B.

What I need to do with some sort of mapping is: overlay image A onto image B to extract the correct non-transparent parts of image B (since now transparency becomes black, i need image A to determine which parts of B are really transparent and not indeed black because of the design), and then paste whatever comes out of that into image A, so that image A will be a mix between the original transparent parts and the better resolution image B.

I don't know if there are any tricks or functions to achieve this with jimp. may someone help me out?

0 Answers0