Omnicolor Images


Given a color palette, make an image that uses each color exactly once.

omnicolor image

Obviously, this is not done by placing the pixels in order, as that would make a rather boring image. Nor am I doing so by hand, because Programmatically, for each pixel, I choose the color that is closest to its neighbors.

In psuedo-code, the algorithm is as follows.

frontier = [random_point]
palette = color_palette()
while has_points(frontier){
  new_point = choose_location(frontier)
  desired_color = average_neighbor_color(new_point)
  new_color = find_closest(palette, desired_color)

  image.set(new_point, new_color)


omnicolor image

Since the algorithm proceeds point by point, one can show the progression as it places pixels. The video below shows how the algorithm proceeds.

By adjusting the choose_location() function, I am able to produce a range of effects, such as the patchwork filling in the above video.

This project was inspired by this stackexchange challenge.