Why RGB?

Everything else that doesn't fall into one of the other PB categories.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Why RGB?

Post by netmaestro »

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
Enthusiast
Posts: 731
Joined: Wed Apr 21, 2004 7:12 pm

Post by Killswitch »

It doesn't work with manufactured colours but with light.
~I see one problem with your reasoning: the fact is thats not a chicken~
User avatar
Fou-Lu
Enthusiast
Enthusiast
Posts: 201
Joined: Tue Jul 12, 2005 8:30 am
Location: I'm pretty sure this is all a nightmare
Contact:

Post by Fou-Lu »

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:

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)
EndProcedure
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. :wink:

~Fou-Lu (aka Lørd Cinneris (actually Elias Sant'Ana))

Image Image
User avatar
dobro
Enthusiast
Enthusiast
Posts: 766
Joined: Sun Oct 31, 2004 10:54 am
Location: France
Contact:

Post by dobro »

it 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

:D
Image
Windows 98/7/10 - PB 5.42
■ sites : http://michel.dobro.free.fr/
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post by Dreglor »

yes paint, doesn't use the rgb model but light does
~Dreglor
DarkDragon
Addict
Addict
Posts: 2347
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Post by DarkDragon »

And why don't we use YUV(Some tools also use this)? :?
bye,
Daniel
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

because rgb is the easiest one to understand. And the most correct one in this case, and most low-level as it is light we are mixing. Only few artists would complain.
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

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. :wink:

http://en.wikipedia.org/wiki/RGB

http://en.wikipedia.org/wiki/CMYK
--Kale

Image
DarkDragon
Addict
Addict
Posts: 2347
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Post by DarkDragon »

Kale 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. :wink:

http://en.wikipedia.org/wiki/RGB

http://en.wikipedia.org/wiki/CMYK
You have forgotten
http://en.wikipedia.org/wiki/YUV
bye,
Daniel
User avatar
griz
Enthusiast
Enthusiast
Posts: 167
Joined: Sun Jun 29, 2003 7:32 pm
Location: Canada

Post by griz »

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
MikeB
Enthusiast
Enthusiast
Posts: 183
Joined: Sun Apr 27, 2003 8:39 pm
Location: Cornwall UK

Post by MikeB »

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
Post Reply