Painting in Millions of Colors
Written by David Conrad   
Sunday, 09 March 2014

A recent contest challenged devs to come up with a program to create an image that contains all the RGB colors exactly once. It produced some stunning results and the winner, by popular vote, was Jozsef Fejes with his Rainbow Smoke image.

The challenge, set on the StackExchange site Programming Puzzles & Code Golf, sounds simple until you start to think about the constraints:

  • Create the image purely algorithmically

  • Image must be 256×128 (or grid that can be screenshot and saved at 256×128)

  • Use all 15-bit colors, that is the 32768 colors that can be made by mixing 32 reds, 32 greens, and 32 blues

Other stipulations were no embedded images or external input,  web queries, URLs or databases.

The contest lasted 7 days and attracted entries in several languages including Processing, Java, Python and C++. You can view the code as well as the images produced on Programming Puzzles & Code Golf.

Participants were asked to vote for:

the most beautiful images made by the most elegant code and/or interesting algorithm.

The winner with 144 votes was Hungarian programmer Jozsef Fejes using C#. His entry explanation states:

I put a random pixel in the middle, and then start putting random pixels in a neighborhood that most resembles them. Two modes are supported: with minimum selection, only one neighboring pixel is considered at a time; with average selection, all (1..8) are averaged. Minimum selection is somewhat noisy, average selection is of course more blurred, but both look like paintings actually.

But that was just the start. Fejes found he could not "stop playing" and went on the use hi-res, rendering 24-bit colour and displaying 16,777,216 pixels in the image.



 (click to view higher-res version)



  (click to view higher-res version)


On his blog Fejes outlines his progress from 15-bit images, through 18-bits and 21-bits to 24 bit. Moreover. he has released his source code under GPL on and produced a You Tube video that has gone viral:

Fejes explains:

Naturally, video compression destroys the possibility of accurately having all colors exactly once. This video was made to just look spectacular, to show how the images are made. There are some bad video artifacts around 2:35. Sorry, please don't look too closely and blame YouTube for that.

He adds:

The song is Pachabelly by Huma Huma, from the YouTube audio library.

You can also buy prints of the two versions of Rainbow Smoke.



More Information

Programming Puzzles & Code Golf

All RGB colors in one image

Source code - Joco Tools

Related Articles

WebGL - Trojans, Snakes And Real Time Textures

Amazing Siggraph 2013

Computer Simulated Knitting

Solid 3D Projection That You Can Touch

DirectX Not Dead - Version 12 At GDC


To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, Facebook, Google+ or Linkedin,  or sign up for our weekly newsletter.


kotlin book



or email your comment to:



JetBrains Releases Qodana Self-Hosted

JetBrains has released Qodana Self-Hosted, a version of its code quality platform that can now be managed and maintained by the customer on their infrastructure.

Amazon Timestream for InfluxDB Handles Your Time Series Workloads

Amazon has announced Timestream, a fully-managed time series database service that is based on open source InfluxDB.
But what is a time series ?

More News

Last Updated ( Sunday, 09 March 2014 )