zsmb's prog site




This one's been a long time coming. Yes, colourful squares in yet another project. Not even sorry. Anyhow, here's a mosaic generator, originally inspired by LEGO.


This application lets you create mosaic pictures. You can specify the sizes of the squares, as well as the available colours for it to use. As per the inspiration, the default colour scheme is the 42 solid colours that LEGO pieces come in, as seen on  this wiki page. This, of course, means that you can reproduce the generated mosaics from actual plastic bricks, should you choose to do so.


This one is fairly straightforward, not a whole lot of features, just the basic implementation of what I wanted to exist. When you've got your settings right, you can save your creations in various image formats using the Save As option.

If you wish to create your own colour scheme to use with the application, look at the  colours.txt file as an example of the required file format. The comments can be omitted, as they are in  colours_greyscale.txt.


This was a fun one to make, C# and Windows Forms both have some interesting features I could try along the way.  ReSharper came in very handy to do some of the things that Visual Studio seems to be struggling with.

There is some black magic involved in the colour calculations - those parts of the code were lifted over from an earlier C++/SDL2 project that was doing basically the same thing as this one, just in a very non-flexible way. The important thing that I'm doing there is transforming the colours into the Lab colour space, where  distances can be much better calculated than other colour spaces, such as RGB.


Downloading the zip file that contains the executable results in a warning (at least in Chrome) as a security measure, but you can choose to "Keep" it.


Update: fixed naming inconsistencies and broken about link.

Name Description Size Date
mosaic.zip Windows executable with dependencies and examples 1.15 MB 2016.07.18.
mosaic_solution.zip Visual Studio 2015 Solution 376 KB 2016.07.18.