A genetic algorithm transforms a uniform image containing a grid-like pattern of every colour. It uses a reference image and swaps two pixels at a time, but only if the swap makes the image closer to the reference image. This image was run for ~5,000,000,000 generations (12 hours on my old laptop). You can find out more and download the program here:
https://troydev.co.uk/every-rgb. It is fully open source and in C++, feel free to use the source code as you wish =]