Jul-02-2017, 06:53 PM
I recently found the site https://allrgb.com/ and also recently saw the stack overflow code golf for a similar project: https://codegolf.stackexchange.com/quest...all-colors
The basic idea is that you generate an image which contains all 15-bit rgb colors. That's 32 red values, 32 green values, and 32 blue values, for a total of 32768 colors, equally spaced along the color spectrum, creating an image that's 256x128 in size. That's at a minimum, using more colors would obviously require a larger image, including the full 0-256 spectrum would produce a 4096x4096 image.
The colors should all be used, and none more than once.
That's all the rules. From them, you can make incredible things (see the source links for examples).
To kick things off, here's a python version of the reference provided on Stack Overflow, with the output it produces.
The basic idea is that you generate an image which contains all 15-bit rgb colors. That's 32 red values, 32 green values, and 32 blue values, for a total of 32768 colors, equally spaced along the color spectrum, creating an image that's 256x128 in size. That's at a minimum, using more colors would obviously require a larger image, including the full 0-256 spectrum would produce a 4096x4096 image.
The colors should all be used, and none more than once.
That's all the rules. From them, you can make incredible things (see the source links for examples).
To kick things off, here's a python version of the reference provided on Stack Overflow, with the output it produces.
from PIL import Image, ImageDraw max_width = 256 max_height = 128 dim = (max_width, max_height) im = Image.new("RGB", dim) draw = ImageDraw.Draw(im) width = max_width step = 8 colors = [(r, g, b) for b in range(0, width, step) for g in range(0, width, step) for r in range(0, width, step)] for y in range(max_height): for x in range(max_width): # pop, so each color is only used once color = colors.pop(0) pos = x, y draw.point(pos, color) # make sure all colors have been used assert not colors del draw im.save("out.png") im.close()