Inspired by the gorgeous work of Marco Sodano – http://bit.ly/2DYDAes (he did that with real Lego blocks one by one 😬). I decided to write a script to turn any photo/image into Lego blocks. I started with Processing/Java and it was really fun to watch the end result. I ended up with some custom parameters to define the block size or even a color to exclude from my script scan.

Processing header file:
String REF_IMAGE = “girl_with_a_pearl_earring.png”
int BLOCK_SIZE = 30;
boolean PRINT_RESULT = true;
boolean PRINT_FRAMES = false;
color BYPASS_COLOR = color(255, 0, 0); // optional
The end result playing with BLOCK_SIZE – aka Lego block
I was happy with that but I have to admit I was a little bit frustrated by how hard is to draw complex graphics on Processing e.g inverted masks. So a needed to move on and start something very new for me: Write code on Cinema4D.

C4D was perfect for all the graphics processing but there is a lack of documentation of the C4D Python API and debugging is a nightmare. Well, I took some time to figure out how scale matrix and clone material and object should work but at the end of the day I had a beta version running on C4D.
The C4D/Python script is very similar to the Processing/Java one. It takes about 6s to scan, create and apply the texture and translate the blocks into the grid. Render and illumination is a step beyond you should do that on your own if you'll ever use this script. But it’s awesome how this automation can save you a lot of time. Creating block by block and picking up the right color can be as hard as playing with real Lego blocks.

Both scripts (Java/Python) will be released as open source very soon.

Thank you.
{Lego}
4
89
1
Published:

{Lego}

4
89
1
Published: