Why RGB?
- netmaestro
- PureBasic Bullfrog

- Posts: 8452
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Why RGB?
RGB stands for Red, Green, Blue components of a color you are making. But the colors made this way don't match the colors in the real world. For example, the PB command RGB(255,255,0) makes a bright yellow. Yet if you take some red paint and some green paint and mix them you don't get anything like yellow. More like a brown. But if you mix red and yellow paint you will get green. So my question is, why is it RGB in computing when RYB makes more sense and follows the real world?
BERESHEIT
-
Killswitch
- Enthusiast

- Posts: 731
- Joined: Wed Apr 21, 2004 7:12 pm
- Fou-Lu
- Enthusiast

- Posts: 201
- Joined: Tue Jul 12, 2005 8:30 am
- Location: I'm pretty sure this is all a nightmare
- Contact:
That's true. If you want the real world colors, some programs work with CMYK (cian, magenta, yellow and black) like photoshop, that way you'll get the results you expect.
In PureBasic you could do like that:
With this you can generate the colors with cian, magenta and yellow components. So, CMY(128,255,0) would give you purple, as you'd expect. Personally I think this is useless... RGB makes more sense, you only need to get used to it. 
In PureBasic you could do like that:
Code: Select all
Procedure CMY(cian,magenta,yellow) ; or RYB, whatever...
red=255-cian
green=255-magenta
blue=255-yellow
ProcedureReturn (red+green<<8+blue<<16)
EndProcedureit is the difference between subtractive synthesis and additive synthesis!
subtractive synthesis
http://www.bway.net/~jscruggs/sub.html
additive synthesis!
http://www.bway.net/~jscruggs/add.html

subtractive synthesis
http://www.bway.net/~jscruggs/sub.html
additive synthesis!
http://www.bway.net/~jscruggs/add.html
-
DarkDragon
- Addict

- Posts: 2347
- Joined: Mon Jun 02, 2003 9:16 am
- Location: Germany
- Contact:
Yep RGB is the primary colours of the visible light spectrum as all colours mixed together create white, whereas all inks mixed together create yukky black.
http://en.wikipedia.org/wiki/RGB
http://en.wikipedia.org/wiki/CMYK
http://en.wikipedia.org/wiki/RGB
http://en.wikipedia.org/wiki/CMYK
-
DarkDragon
- Addict

- Posts: 2347
- Joined: Mon Jun 02, 2003 9:16 am
- Location: Germany
- Contact:
You have forgottenKale wrote:Yep RGB is the primary colours of the visible light spectrum as all colours mixed together create white, whereas all inks mixed together create yukky black.![]()
http://en.wikipedia.org/wiki/RGB
http://en.wikipedia.org/wiki/CMYK
http://en.wikipedia.org/wiki/YUV
bye,
Daniel
Daniel
When you add pigments (paints) together ... they get darker. When you add light ... things get brighter. If you shine a Red, Green and Blue flashlight on a wall, they converge to white.
HSV is another color space that is interesting : http://en.wikipedia.org/wiki/HSV_color_space
HSV is another color space that is interesting : http://en.wikipedia.org/wiki/HSV_color_space
One very good reason for using RGB is that the image formed on a monitor is composed of Red, Green and Blue. Also as anyone who has dealt with the principles of light and colour as in school physics will know, all colours can be made from the RGB values as these are the primary colours. Cyan, Magenta and Yellow are secondary colours each made from two of the primaries, Cyan = Blue+Green, Magenta = Red+Blue and Yellow = Red+Green. The reason why this does not apply to paint is because of the impurities in the paint, as well as the fact that with paint you are dealing with what is absorbed. Red paint absorbs green and blue, reflecting red, Green paint absorbs Red and Blue and reflects Green. A mixture of the two will absorb pretty well all Blue as both paints absorb it, but also one of the two is absorbing Green and the other is absorbing Red, so you don't get the yellow you would expect but a degraded version which is brown. This is because it is a subtractive process, your monitor however is additive so that Red+Green = pure Yellow as you get both in full added together which is RGB(255,255,0).
Sorry this is a bit long winded but it happens to be a subject I know a lot about as an ex fully qualified professional photograper.
MikeB
Sorry this is a bit long winded but it happens to be a subject I know a lot about as an ex fully qualified professional photograper.
MikeB


