Mobile app version of vmapp.org
Login or Join
Cofer715

: A 2d image of all possible rgb colors I've been searching for an image that contains all possible rbg colors, but I simply cannot find one. I'm starting to think that's it's impossible, since

@Cofer715

Posted in: #Color

I've been searching for an image that contains all possible rbg colors, but I simply cannot find one. I'm starting to think that's it's impossible, since what I'm looking requires 3 dimensions.

I tried looking for things like "color wheel" or "hsv color" but I have been unable to find exactly what I'm looking for.

Is it even feasible to try to find a 2d image to represent a full rgb color scheme? And if yes, where can I find one?

To be explicit, I want a 2d image containing all (rgb) values (0-255, 0-255, 0-255)

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Cofer715

1 Comments

Sorted by latest first Latest Oldest Best

 

@Holmes874

There are 16,777,216 (256^3) possible RGB color combinations, so a square image in which each color is assigned a single pixel would have dimensions of 4096 px by 4096 px.

The following Processing code will generate such an image:

int numLevels = 256; // Number of levels per color channel
int numChannels = 3;

int dim = (int)sqrt(pow(numLevels, numChannels));
int curX = 0, curY = 0;
color curColor;

void setup(){
size(dim, dim);
colorMode(RGB);
noLoop();
}

void draw(){

for (int rVal = 0; rVal < numLevels; rVal++){
for (int gVal = 0; gVal < numLevels; gVal++){
for (int bVal = 0; bVal < numLevels; bVal++){
curColor = color(rVal, gVal, bVal);
set(curX, curY, curColor);
curX++;
if (curX >= dim){
curX = 0;
curY++;
}
}
}
}

save("rgb_colors.tif");

}


Most operating systems won't allow Processing to create a window large enough to display the entire image, but the full-size image will be saved as rgb_colors.tif and placed in the same directory as the script.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme