0
$\begingroup$

I wanted to validate a thought on blending of colours digitally.

Imagine I have two colours, $C_1$ $(R_1,G_1,B_1)$ and $C_2$ $(R_2,G_2,B_2)$. Now, I create colour $C3$ as follows: $C_3 = \alpha C_1 + (1-\alpha) C_2$

Where $\alpha$ is a value between $0$ and $1$. So, yes, basically, I am trying to put one object over another with a transparency associated with it.

What I want to understand is that, if I have $C_3$, $\alpha$ and $C_1$ in the above equation, will I get an accurate value of $C_2$?

Math suggests that I should, but I just want to confirm that I am not missing anything. Also, can I keep a really high but $< 1$ value for $\alpha$ and still accurately get $C_2$?

$\endgroup$
0
$\begingroup$

You actually have 3 independent equations.
If one of them is solvable, all three are.

Now, the equation is given by:

$$ z = \alpha x + \left( 1 - \alpha \right) y $$

Assume $ \alpha, x, z $ are known, then:

$$ y = \frac{z - \alpha x}{1 - \alpha} $$

For any value of $ \alpha \neq 1 $ the solution is valid.
Moreover, if $ alpha = 1 $ then $ z = x $ and $ y $ is irrelevant.

Looking at the other case, restoring $ x $, yields:

$$ x = \frac{z - \left( 1- \alpha \right) y}{\alpha} $$

For any value of $ \alpha \neq 0 $ the solution is valid.
Moreover, if $ alpha = 0 $ then $ z = y $ and $ x $ is irrelevant.

As you wrote, in order to have a Linear Interpolation the parameter $ \alpha $ must be in the range $ \left[ 0, 1 \right] $.

$\endgroup$
  • $\begingroup$ Yes. I ended up writing some code to try it out and it works perfectly fine. $\endgroup$ – TheBlueNotebook Dec 5 '15 at 4:58
  • $\begingroup$ Hi, Great to hear. It would be great to mark the answer so the question will be marked as solved. Enjoy... $\endgroup$ – Royi Dec 5 '15 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.