Let image1 be:

enter image description here

And RGBA mask be:

(45, 78, 251, 102)

Apply mask on top of image1 to get image2:

enter image description here

Now I need to do the reverse thing, given image1 and image2, is there a formula or an algorithm (there has to be right?) to find the mask?

Thanks in advance, first post in here I might lack vocabulary I'm sorry about that, my tags might be completely off.

EDIT: i program in Java. I get image2 by drawing image1 on some Windows native frame using Graphics#drawImage and then drawing the filter made of (45, 78, 251, 102) RGBA pixels on top of that image using the same function.

  • $\begingroup$ What does "mask" mean in this context? That looks more like a multiplication than any kind of "masking". $\endgroup$ Commented Nov 1, 2020 at 22:10
  • $\begingroup$ By mask I meant an image filled with (45, 78, 251, 102) RGBA pixels. $\endgroup$
    – dylanbatio
    Commented Nov 1, 2020 at 23:16
  • $\begingroup$ OK, so you have an image with that color. But what do you do with it? The term "mask" is usually meant to apply to an image that obscures part of another image. Are you talking about blending with the image? And if so, is it a weighted blend based on the alpha? My question is what exactly is the mathematical function you're talking about here. Because "mask" isn't a function that I'm aware of. $\endgroup$ Commented Nov 2, 2020 at 0:33
  • $\begingroup$ I'm just looking for the RGBA color (this is what I meant by mask) I need to apply on top of my first image in order to obtain the second image. $\endgroup$
    – dylanbatio
    Commented Nov 2, 2020 at 1:53
  • $\begingroup$ And I'm looking for the math function you used when applying that color to the source image to get the result. The word "mask" is telling me precisely nothing. Is this a multiplication operation? What is the mathematical equation being performed per-pixel to get the result? Please put that in your question. $\endgroup$ Commented Nov 2, 2020 at 1:57


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.