Jeetesh Nataraj
Jeetesh Nataraj

Reputation: 608

How convert 16 colour value to 32 colour value?

I have set of RGB values

    private static final int sixteen_Colour [][] = {
    { 237,237,237 },
    { 203,0,0 },
    { 240,56,0 },
    { 255,63,0 },
    { 255,115,0 },
    { 255,9,0 },
    { 255,290,0 },
    { 255,248,193 },
    { 255,255,255 },
    { 179,241,255 },
    { 83,209,255 },
    { 26,163,255 },
    { 0,121,123 },
    { 5,48,245 },
    { 54,5,191 },
    { 26,0,125 }

};

If have to convert them into say 32 colour values, one method that I used is taking the average of two set, say { 237,237,237 },{ 203,0,0 } would result in {220,119,119} is this an appropriate method?

Upvotes: 0

Views: 56

Answers (1)

user1118321
user1118321

Reputation: 26375

What are you trying to accomplish? Your method will work. It's essentially a linear interpolation between the existing values. But whether it will give you good results or not is dependent on what you're trying to do.

You might be better off converting to a perceptual space, like HSV (Hue, Saturation, & Value color space), and doing the interpolation in that space, then converting back to RGB. Interpolations in RGB tend towards gray, whereas in perceptual spaces, they tend to give us what we think of as "in-between" colors.

Upvotes: 1

Related Questions