Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Calculating RGBA given different RGB colours.

Posted on 2010-08-26
4
Medium Priority
?
249 Views
Last Modified: 2012-05-10
Hello,

I have three RGB colours, background, foreground and target. The target colour is always between the background and foreground colours. Now, given these three RGB colours, I want to find out what the alpha channel of the foreground colour should be to give the closest approximation of the target colour that only had the RGB channels.

Any ideas on where I can even start this thing???

Thanks,
Uni
0
Comment
Question by:Unimatrix_001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 2000 total points
ID: 33532897
depending n how you define closest, it may be
(rt+gt+bt)-(rb+gb+bb)/((rf+gf+bf)-(rb+gb+bb))
or
((rt-rb)/(rf-rb)+(gt-gb)/(gf-gb)+(bt-bb)/(bf-bb))/3
perhaps with gamma or other correction
0
 
LVL 3

Author Comment

by:Unimatrix_001
ID: 33533637
Hi ozo,

Very sorry for not getting back sooner, thanks very much - I'll give them a go this evening and let you know how things are.

Thanks again,
Uni
0
 
LVL 3

Author Comment

by:Unimatrix_001
ID: 33534928
Very well done ozo... I really am jealous how you seems to just know how to solve any maths issue... :(
0
 
LVL 3

Author Closing Comment

by:Unimatrix_001
ID: 33534929
Brilliant!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article seeks to propel the full implementation of geothermal power plants in Mexico as a renewable energy source.
Lithium-ion batteries area cornerstone of today's portable electronic devices, and even though they are relied upon heavily, their chemistry and origin are not of common knowledge. This article is about a device on which every smartphone, laptop, an…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question