|Home||LEGO creations||ministeck mosaics||Contact|
(January 2009 - November 2011)
2012: Changes have been made to the program since - update coming up...
How to turn
In 2003 I bought myself a legal copy of Visual Basic, to write a program to convert images to the colour-palette of LEGO (or ministeck). It was quite an investment, because this new software also required Windows XP Professional. The computer on which I installed the software, was replaced by a laptop in 2007... with Windows Vista as operating system. Unfortunately Vista didn't support my version of Visual Basic, so everytime I wanted to do something with mosaics I had to start up that old computer again. That very old and very, very slow computer...
But at the end of 2008 - when I was looking around for another laptop with twinload Vista/XP - I made a great discovery! Microsoft had a Visual Basic 2008 Express Edition for free download available. Yippie!! That was the sign for me to make a new start. I immediately started digging the Visual Basic Help-pages: my first program was a rather unfinished product and desperately needed some modifications. I may be good with mathematical algorythms, I'm certainly not a programmer...
This is what I ended up with (and there's still room for improvement):
(The images used as example on this page are beautiful landscapes of Ravensburger-puzzles)
The first tabpage only shows two buttons. By clicking the "Select Image"-button, Windows Explorer pops up. It permits the user to browse the computer searching for a suitable JPEG-image (only .jpg-files, because other file-extensions caused unexpected errors). The "Clear Current Image"-button was added to give the user the possibility to convert other images too, without having to close and reopen the application (I got weird error-messages without this small piece of code).
The second tabpage shows the user all the available colours, in different colour-palettes: "standard" LEGO-colours, standard ministeck-colours, greyscale ministeck-colours and sepia ministeck-colours (unfortunately these sepia-colours are no longer produced, I'll have to do it with my current supply by taking apart the mosaic of my children).
The third tabpage shows a lot more buttons. The three buttons on the left are button-styled checkboxes. They can be checked/unchecked at any time (before conversion).
Finally there's a button to maximize the result: a new window pops up showing the converted image fitting to the entire screen. This gives you the possibility to make some changes (check/uncheck colours, check/uncheck dithering,...) until you are satisfied with the result.
This tabpage has only two buttons:
On the final tabpage you find three buttons that give you the possibility to save all the files. Every time Windows Explorer pops up to let you browse through your documents to find the right map to store your data.
The image on the left shows an excerpt of the output code that was generated from the previous example (with 80x64 ministeck baseplates). The printout pages are in portrait-orientation with 40 columns and 32 rows each, resulting in four pages for one ministeck baseplate.
The image on the right shows one page of a mosaic with dithering and brickwall structure (to avoid the use of 1x1 elements). With 48 columns and 24 rows, you only need to print two pages to cover one 48x48 baseplate.
The black lines between two different colour-areas are special characters from the "Courier new" character-set. It's exactly the generation of these frame-lines that makes the code generation such a time-consuming task: the borderlines on the right and bottom of each page are repeated on the next (adjacent) pages, which makes this type of output very easy to read.
I lack programming skills to cut/crop images. Therefore it is absolutely necessary that the user selects an input file that is already the right size for conversion: for any mosaic you want to create, you need an input file that is exactly 4 pixels extra, both in height and width. I have this very old program Picture Publisher 6 (legal software that costed me approx. €5). It's probably not as good as Photoshop, but I really like to work with it.
I think I have most colours defined, but it might be useful to have the possibility to add more colours to the colour table. Or even better: I may give the user the possibility to change the current RGB-values of a colour. To be able to do that I'll have to study the Help-section of Visual Basic a little bit harder...
You may have noticed that the maximized result in this image is a bit blurry. I actually wanted to scale the image (as much as possible, depending on the size of the original image), but I discovered that there was something wrong with the scale-property in this version of Visual Basic. I didn't dig any further to find a solution.
If you want to make a studs-up mosaic the input image should also be properly scaled before conversion. To "see" the converted image, it has to be rescaled manually.
This works extremely well with greyscale or sepia coloured images generated without dithering: 1x1 element-reduction of up to 90% where you hardly see a difference in image-resolution. It works okay in many other situations (e.g. landscapes). But I'm not always totally satisfied when I try it on a portrait with dithering: then you really see a change in image-resolution...
There is no element count in my program! At least not for bigger elements. Only 1x1 elements are counted (where all four neighbouring pixels are different). This doesn't mean that you won't need more 1x1 elements as displayed. Imagine a T-shaped area with 4 pixels: you'll need a 1x3 element (or a 2x2 corner) + one extra 1x1 element. It's just an indication of the total amount of required 1x1 elements.
I created a template in swriter (OpenOffice.org equivalent of Word) for each type of baseplate not only to minimize the number of pages to be printed, but especially to have different baseplates printed on different pages (very useful if you like to build bigger mosaics with a bunch of friends where everybody can build his own baseplate). The text-size in these templates was always 10, no matter what I tried. With textsize 10 you need a lot more pages (e.g. 4 pages for 1 48x48 baseplate, 8 pages for 1 80x64 baseplate,...). So I added one manual step: select all text, and change textsize to 8...
It may have been a better choice to save output data to a spreadsheet. In this case everybody could setup his own print-margins and page-orientation. Unfortunately being a non-programmer means that I don't know how to handle spreadsheets in Visual Basic. On top of that I couldn't figure out how to automatically add cell-borders between two different pixels to make that nice-looking output I have.
I call it a real achievement, compared to the program I had on my old computer. It is much more a finished product... but not entirely. And that's exactly why it still won't be available online.
But: I will go to LEGO-events in the future. I will take my laptop with me. I will be demonstrating my program to the public, giving the people the chance to make their own mosaic. And if you bring an SD-card or USB-stick containing your image, I may even decide to put the output data on it, too...