Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / color space conversion: RGBRYB??

Author
Message
obese
21
Years of Service
User Offline
Joined: 15th Oct 2002
Location:
Posted: 16th Oct 2002 23:22
i want to be able to convert between the red,green,blue color space and the red,yellow,blue color space. i cant seem to figure out a conversion method that works without any losss of color information.
does anyone know how i could do this?
*\OBESE/*
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 17th Oct 2002 04:26
there will always be loss of colour information, question is why RED,YELLOW,BLUE?
I would suggest doing it in a bit setup - as i'm guessing this'll be with 16-bit colours.

so something like redbit = (colour/255-(colour/255-(colour/255))/1)
greenbit = (colour/255-(colour/255)/2) bluebit = (colour/255)/3
that way you can have the bit range (i think thats the sum, my brain has kinda goneto sleep)
once you have the bits you then multiply by 8 per bit this can then allow you to surpass the current colour bits blah blah ... well i'm sure you understand (even if the math is wrong which i'm sure it is!)

Holy jumping mother of god NOOOO!!!...
ChipOne
21
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Canada
Posted: 17th Oct 2002 18:20
r = rgbr(colour)
b = rgbg(colour)
g = rgbb(colour)

You can work with the values from there, but I'd agree there is a loss of colour information there too. There is a video-editing software package which claims to have "the lowest amount of colour degredation possible" which kinda indicates there will always be at least some.

The problem that seems to be discussed again and again out on the net is that RGB and RYB aren't true additive or subtractive colour descriptors, meaning, not all colours are really producable with those values. CMY (and in the print world, the addtional use of K) seems to be the best way to represent, mathimatically, each and every colour.

To make matters worse, I can't for the life of me find a formula that would allow you to convert RGB to RYB. I did find someone describing the theory of changing RYB to CMYK, but no actual implementation, and it's not really what you're looking for.

Sorry I couldn't help more...I did spend a good couple hours reading up on colour theory though.

Be sure to post here if you find what you're looking for.

-= i only do what my rice krispies tell me to do =-
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 17th Oct 2002 22:54
hehee... well i forgot DBpro had those
would save alot of math eh - i'm not sure why he want RYB though it doesn't make a lick of sense to me!
i mean i can convert RGB > CMY very easily - all you have to do is get the 24-bit equavilant of the RGB then rebuild based a hue set (which is best in Hex).

Oh well perhaps if i had the time (or inclination i'd actully checkup on this) - but right now i'm building WADs for use with DarkBasic ... and trying to see how they're working - hope to have a simple tut out in a few hours

Holy jumping mother of god NOOOO!!!...
Marc Fleury
21
Years of Service
User Offline
Joined: 1st Oct 2002
Location:
Posted: 18th Oct 2002 07:29
"CMY (and in the print world, the addtional use of K) seems to be the best way to represent, mathimatically, each and every colour."

Actually, there are many colours which you can represent in RGB which are not within the CMYK gamut.

I assume that obese was really talking about converting to CMY (not Blue Red and Yellow). Cyan Magenta and Yellow are the standard subtractive colours. And it is very true that there will be information loss. Bright blues cannot be printed with CMYK.

Learn DB here -- http://www.dbheaven.com/ -- Learn DB here
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 18th Oct 2002 09:24
yeah and certain parts of the the green spectrum...
but even if that is what he wants to convert too - still a little baffled why he wants to achieve this within a game development package, i mean i use the colour schemes in Paintshop so that i don't have great amount of colour loss when i scan stuff in or are about to print it out (though my Lexmark autmatically sorts that out)

Holy jumping mother of god NOOOO!!!...
Mirthin
21
Years of Service
User Offline
Joined: 13th Oct 2002
Location: Land of the Rising Haggis
Posted: 18th Oct 2002 16:00
Cyan, Magenta, Yellow? What's the K stand for?
ChipOne
21
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Canada
Posted: 19th Oct 2002 00:31
Actually, we're all right in this case (although, that first information I had on additive and subtractive colours was innacurate). The difference in CMYK and RGB is the way the colours are produced. This is from one of the sights below:

Quote: "Additive color emanates directly from a light source. Subtractive color comes from light which is relfected off of an object from a light source. Because additive color comes to our eyes directly (unless it is filtered), it is purer color."


The other side of the coin, though, is that there are colours in the CMYK which cannot be produced with RGB methods.

By the way...K is for black, so as not to be confused with blue.

Here are some links for more reading:
http://www.sparklenet.com/1_Main_Street/Art_Smarts/Color/Nature/CMYK_vs_RGB.htm
http://marvin.mrtoads.com/rgb_vs_cmyk.html
http://dx.sheridan.com/advisor/cmyk_color.html

And try these searches in google (without the quotes):
"cmyk rgb color space"
"cmyk vs rgb"
"cmyk rgb color space conversion"

BTW, the most common spelling of "colour" seems to be "color" because of those yankees to the south of me. You can try either-or when doing searches.

Thanks all...this topic has been colourful! (every once of pun intended).

-= i only do what my rice krispies tell me to do =-
obese
21
Years of Service
User Offline
Joined: 15th Oct 2002
Location:
Posted: 27th Oct 2002 16:44
the reason that i want to convert RGB<->RYB is for my image editor.
i want to be able to do more accurate color transformation like inversion, so yellow and blue will not be opposites, but blue and orange, yellow and purple.
i want my program to be a digital artist tool, and the basic colors of artists are RYB. i know how to work with those colors better.
also, blurs will work more how i want them too using RYB.
my plan is to have the image drawn in RGB (because that is the only one the computer understands)
then for editing puposes, i will convert the image to RYB, edit it, then convert back to RGB, for display on screen.


i understand that there must be loss of color, but i am looking for minimal color lossage (?). i have seend plugins and such for photoshop or paintshop that do
what i'm searching for (i think), but i did not want to buy that, because i only want the formula, which i wouldnt get from buying the plugin, anyway.

*\OBESE/*
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 28th Oct 2002 03:20
if you want to set everything up like that then i'd actually suggest working within CYMK with HUE and Saturation

as you'll get the paint opposite rather than the colour opposite.

Anata aru kowagaru no watashi!

Login to post a reply

Server time is: 2024-03-29 08:56:56
Your offset time is: 2024-03-29 08:56:56