How does color toning work?

● ARCHIVED · READ-ONLY
Started by Tsukihime 8 posts View original ↗
  1. When you tint the screen or a picture, how does it determine the RGBA values for each pixel?


    RGBA ranges from 0-255


    Tone components range from -255 to 255
  2. I think it works by increasing or decreasing that specific color on each pixel by a certain amount. I'm not sure how that amount is calculated though.

    Since the ranges are from -255 to 255, maybe it will add that number to the color value of the image, capping out at 255? If so, that would explain why setting a color tone of RGB(255,0,0) makes pure black look like pure red. It would also explain why setting a tone of RGB(-255,0,0) makes the pure reds completely black.

    There might be some other math associated with it somewhere, but just looking at how the colors behave that seems to be how it works.

    EDIT: Oh, that "other math" is probably how grey factors in. I'm not sure where that comes in, all of the above assumed a "grey" of 0.

    EDIT 2: "Grey" might just be a "colorize" function with another name. I notice that setting the tone to RGBg(255,0,0,255) makes all of the colors pure red, but it keeps each color's saturation and brightness value, to a point -- black is still changed to pure red with this tone.

    EDIT 3: Maybe it changes everything to the RGB tone first, then changes the hue of all of the colors to that tone's hue, depending on the grey value? But then I don't think so 'cause that wouldn't explain why some areas become more bright than others.

    Sorry for the stream-of-consciousness posting, heh. I'm just not good at color math in general so I have to puzzle it out step-by-step. I'm sure there's a simple solution to what you're asking.
  3. The method employed to make the tint is quite simple. First, the RGB values are brought to gray based on the tone's power component. Then tone's RGB components are added to the resulting values. Alpha is not touched.
  4. So for RGB


    +255 makes the component max


    -255 basically removes the component


    0 doesn't touch the component


    I'm not sure how the gray works.


    Gray ranges from 0 to 255.


    What does gray of 0 mean? It probably isn't setting the RGB components to 0.


    255 makes the whole image gray.
  5. The gray value denotes the grayscaling power.

    Let's say a color(186, 27, 224). The grayscale color value for this is the mean of all color components, so it is (186+27+224)/3, or about 145.

    The gray denotes how much the original color value will deviate to this grayscale color value. So a gray value of 128 will result in this:

    R = 186 - ((186-145) * 128/255) = 165

    G = 27 - ((27-145) * 128/255) = 85

    B = 224 - ((224-145) * 128/255) = 184

    After this, the resulting color values will be shifted according to the tone's respective color values, which is a simple addition operation with output limited to 0 and 255.

    The grayscale calculation is far more complex when compared to the tone balancing. It is even noted in the help file that the processing time will be longer when it is used.
  6. ^ See? A perfectly simple solution. =P
  7. Hello i don't start new topic since i have a similar question, my problem is that i convert rpg maker xp script CCTS (time system) to vx ace and works fine, but the khas awesome effect works on different rule than my script (CCTS modify a tone depends on hour/month/season/climate) so the easiest way for me is to create a Color object from Tone object and i want to know how it's created from algorithm, what steps i need to do to successfully create new color object from Tone object (i believe it's possible since The Tone object somehow change Color object on screen). I tried using the algorithm that ShadowLurk showed but it doesn't return a proper Color object.
  8. dullman said:
    Hello i don't start new topic since i have a similar question,
    Please do start a new topic and do not hijack someone else' topics or necropost. There are a lot of reasons for that.

    This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.