What Google Engineers do for Fun: Computerized LEGO Art Project

What happens when you are really smart… like Google-lead-engineer smart, you move into a new place that has a big blank living room wall and you end up being bored one weekend? Well, I’ll tell you what I would do… I would order pizza, probably watch a movie, stare at the wall for a good 45mins until I decided it wasn’t going to change on its own, then play some video games.

But that’s not what Justin Voskuhl did.

What you see above isn’t a horribly pixelated image in 8-bit or something that like… it’s actually a picture of a flower done completely with LEGO pieces; yes these:

What Justin did is write a computer program that, taking a source picture, would establish the most optimized colors, Lego brick sizes and orientations in order to reproduce the source image completely in LEGO.

To do this justice, I’ll just paste his explanation here:

I moved into a new place about ten months ago, and had a huge
blank wall in the main room.  So I decided to make some funky
LEGO art
for the walls.

I started with some square nature images, and wrote some Java code to
use a simulated annealing technique to figure out a layout for
LEGO
bricks that when stacked on each other look like the image (but also
try to minimize cost of the parts, and also try to ensure the result
has some structure rigidity – these images are held together only by
gravity and the
LEGO bricks themselves – no glue.

So the Java program runs for about ten hours for each image, spits out
a preview and parts list and some HTML that you can print out to use
as a diagram to assemble the whole thing.  The assembly time took
about fifteen hours for each image.  I enslaved some graduate student
friends of mine and traded free dinner for time in my
LEGO sweatshop.

Check out the results.  Each image is pretty different, but all with a
nature theme.  For scale purposes each one is a 34×34 inch square.
The
LEGOs are stacked 250 rows high, and 100 “lego nubs” wide.  The
maple leaves are on a background that dithered a LOT but I thought it
was a feature since it really shows off the fact that these are just
stacks of
LEGO bricks.

More or less what I would have done had I had an empty white wall… either writing annealing algorithms to reproduce pictures with LEGOs, or draw on it with washable Crayon; something my wife let’s me do every Saturday if I’m good.

Justin has plans to release the source code soon, so stay posted!

Check out the gallery while we wait:

Tags: , , ,

About Riyad Kalla

Software development, video games, writing, reading and anything shiny. I ultimately just want to provide a resource that helps people and if I can't do that, then at least make them laugh.

, , ,

56 Responses to “What Google Engineers do for Fun: Computerized LEGO Art Project”

  1. slashdotter October 10, 2008 at 5:38 pm #

    Are you aware that you’ve just been slashdotted? As in front page?

  2. Anonymous Coward October 10, 2008 at 9:17 pm #

    I tried doing something similar about a year ago by trying to reduce the number of available colors in a pallete to just those available in legos. Unfortunately I don’t know photoshop well enough to figure it out. But now I don’t have to. :)

    • Ju November 10, 2010 at 8:07 am #

      Hi

      If you want to do similar things, you can try http://www.mosaicsmaker.com .
      You can upload a photo, the website transfroms it in a LEGO mosaic and you can download a documentation to assemble it yourself.

      • Riyad Kalla November 10, 2010 at 9:51 am #

        Ju that is seriously slick, thanks for the link!

  3. TheSpatulaOfLove October 10, 2008 at 10:09 pm #

    That is fantastic! I’m sure Lego would be very interested in seeing this application.

  4. simoncpu October 11, 2008 at 12:09 am #

    Is it possible to make the code publicly available? Thanks!

  5. Mike October 11, 2008 at 1:17 am #

    It’s a shame that (a) a lead Google engineer can’t afford a decent camera and (b) you need to install some decent gallery plug-in please! ;-)

  6. Eugene October 11, 2008 at 1:47 am #

    If _I_ were “like Google-lead-engineer smart”, I would use “it’s” when I meant “its”. Because I would be _way_ too smart to know about grammar and stuff.

  7. rahn October 11, 2008 at 6:24 am #

    Todd Osborn AKA Soundmurderer did this same thing a few years ago.
    http://www.youtube.com/watch?v=7404tZehlos

    he makes tremendous jungle music as well!

  8. Mitch October 11, 2008 at 7:03 am #

    Why the intellectual fellatio at the start of the article? Some friends and I did stuff like this back in the early 1980s when we were just teenagers, except we used little ceramic tiles and an old Apple II computer. Sorry, but no rocket science here.

  9. Flo October 11, 2008 at 7:44 am #

    Nerd! There are no tits on that wall…

  10. Jimbobuay October 11, 2008 at 7:56 am #

    One word: Awesome!

  11. Justin October 11, 2008 at 8:42 am #

    I know that there were a few projects similar to this in the past. I think for a while Lego.com even offered a mosaic program that would do something similar to your photos. However, I seem to be having a hard time finding any of the applications and Lego’s application is long gone. Any chance you want to throw the code up on github.com? That would provide a great way to share the application and let others help improve it. At any rate very cool pictures.

  12. Editor October 11, 2008 at 9:37 am #

    I’ve pinged Justin for the source code, he mentioned some basic cleanups and then we’ll get it linked up here for you guys.

    As a commenter on Slashdot pointed out, at the onset this project might not *seem* like the most amazing thing ever, but when you consider it also balances the cost of Legos to build the pictures and the most optimized build materials to do it, it’s pretty dang slick.

  13. Christian Treczoks October 11, 2008 at 9:40 am #

    There is already a very interesting software around called PicToBrick, written by Tobias Reichling and Adrian Schütz. Have a look at the tool and some creations made with it:

    http://www.pictobrick.de/de/pictobrick.shtml

  14. A lego fan October 11, 2008 at 4:26 pm #

    And if you are a very smart microsoft engineer you do that, then you go on to write a program to generate 3D sculptures.

    http://flickr.com/photos/dunechaser/444038134/
    http://seattle.metblogs.com/2006/04/21/lego-sculpture-11th-avenue/
    http://www.brickwiki.org/index.php?title=Image:AngelSculpture.jpg

  15. Editor October 11, 2008 at 4:38 pm #

    A lego fan,

    That’s pretty cool, do you have an article link about how those were made?

  16. A lego fan October 11, 2008 at 10:27 pm #

    Editor,

    David Winkler (the sculptor whose work i mentioned above) has some information at this post.
    http://news.lugnet.com/build/sculpture/?n=925

    You may also be interested in Bram Lambrecht’s paper on 3D rendering and his LSculpt program.
    http://lego.bldesign.org/LSculpt/

  17. redditor October 11, 2008 at 11:20 pm #

    @slashdotter – slashdot is redundant.

    And… Ten fucking hours?

    What the Fuck isthis guy doing? Resampling the source image?

    Really what a moron

    Choose size of output
    Load image, resize to n lines
    First algorithm
    Set each color to nearest lego brick color
    RLE the bricks using known sizes as fits

    Would run in under three seconds for a one meter square mons lisa, would order the bricks using a rest service, print the schematic and make your coffee while doing it. Engineer my ass.

  18. jonathan October 11, 2008 at 11:32 pm #

    I like how the 1/8in x 5/16in part of the plate pieces is the smallest “pixel” (not sure what to call it) rather than the square 5/16in x 5/16in that most people use when doing mosaics. Its less obvious that its made from Legos but its definitely more interesting.

    I’m quite curious how deep these are. If its only one “nub” deep it throws another twist in there because 4 colors don’t come in 1×1 plates. Two deep would make converting the picture to lego pieces easier since you don’t have colors that must be 2 “pixels” wide but also makes it a bit more expensive. If it is 2 nubs deep and still takes advantage of the 1 nub wide pieces and back-fills with less expensive pieces I’m super impressed. I imagine google engineers, or anyone who would take on a novelty project like this, aren’t on as tight of a budget as I am though since I’m back to being a poor starving student.

    I’m planning on making a lego mosaic (1 x 1 nub squares rather than the way these are done) of eeyore for a Xmas present. I’m no purist though and will probably paint white plate pieces so I can get 1×1 plates in the greens and bright purple (then paint the larger green and purple pieces to make sure all the colors match).

    I’m anxiously awaiting this source code. Should I keep tabs on this thread, this blog, elsewhere?

  19. Editor October 11, 2008 at 11:34 pm #

    @redditor, the algorithm does quite a bit more than that, which is why it takes so long to run. Besides running the annealing algorithm it also tries to calculate the most structurally sound layout (e.g. trying to avoid long runs of Legos in horz or vert orientations which would create a “seam”) and also attempts to optimize for the cost of building materials to minimize the expense when you actually try and build the picture (Legos, surprisingly… are not cheap).

    So yes, I suppose *your* algorithm would run much faster, but I promise you the results would be quite a bit different.

  20. Editor October 11, 2008 at 11:35 pm #

    @A lego fan, thanks for the links, very cool stuff.

  21. James Pereira October 12, 2008 at 3:24 am #

    Google engineer smart? Try seventh grade. Why is this a top story on slashdot??

  22. Editor October 12, 2008 at 9:28 am #

    James,

    Awesome followup. Insulting, trite and misses the entire point of the writeup.

    I’m going to mail you a giant gold star that says “Internet Smarty Pants” on it. You wear it, right on your shirt and let everyone know.

  23. The9th October 12, 2008 at 12:49 pm #

    As an unimaginative soul who’s built lots of legos w/his kids over the years, I’d love to see some close-ups of these great-looking things.

    And to know how you approach Lego to get these huge lots of bricks.

    I had the same question about how Normal Mailer managed to get thousands of clear blocks from Lego so that he and his pals could build a coffee-table skyline of Manhattan (article in New Yorker mag way back when). If I recall, Mailer had one complaint–that Lego didn’t make clear “cap blocks”, so the skyline was “dimpled.”

  24. Shawn October 12, 2008 at 2:59 pm #

    10 hours per image?

  25. Nick Berg October 12, 2008 at 9:47 pm #

    The word you’re looking for is LEGO, there’s no such thing as “Legos”.

  26. Editor October 13, 2008 at 8:08 am #

    Nick, thanks for the heads up. I originally wrote the entire article using “l3g0z”… so I guess that was even worse :)

  27. Karl October 13, 2008 at 8:36 am #

    Justin,

    Many of us are sitting here waiting (as though for an original trilogy Star Wars movie) to get the source for this project. I am finishing up my vacation prior to starting a new job and my God would I be a Legoing fool (bet there’s no such word as Legoing, but then again I bet that guy is not Nick Berg [http://en.wikipedia.org/wiki/Nick_Berg])

    Hope you get to post it soon!

  28. Editor October 13, 2008 at 8:38 am #

    Guys,

    Sorry for the delay, emailed Justin twice over the weekend, so hopefully will have a reply to you shortly with regard to the source code.

  29. Justin October 17, 2008 at 6:57 pm #

    Any word on how soon the software will be available?

  30. Riyad Kalla October 19, 2008 at 8:05 pm #

    No word back from Justin yet unfortunately, sorry guys.

  31. Tamer October 31, 2008 at 8:07 am #

    Pretty cool stuff — I’d like to try this with some of my photos!

  32. ts November 29, 2008 at 9:13 am #

    Was the source ever published? It would be a great tool to do create some very nice christmas presents.

  33. Riyad Kalla December 3, 2008 at 8:57 pm #

    Sorry guys, I never heard back from Justin on this… believe me, I’ve sent him just shy of 75 emails.

    I have to imagine he’s buried in work though and I’ll just keep probing until he goes insane or forwards it along ;)

  34. Andy December 23, 2008 at 12:21 pm #

    All I want for Chrismas is the source code for this project.

  35. Jon December 30, 2008 at 4:12 pm #

    Waiting for source code too…..

  36. LEGOgeek April 30, 2009 at 5:59 pm #

    Editor,

    I was wondering if you had any updates on the source code for this. Can we look forward to a link anytime soon?

  37. Riyad Kalla May 1, 2009 at 8:15 am #

    LEGOgeek, sorry guys, never got a reply back from Justin — and I pestered the hell out of him for it… it’s very likely we aren’t even friends anymore ;)

  38. legolover August 16, 2009 at 11:21 am #

    What happened with posting the code? I’d love to give this a try!

  39. Riyad Kalla August 18, 2009 at 8:23 am #

    I was never able to get in touch with Justin about it unfortunately. Multiple death threats later and a puppy to say “I’m Sorry” and I’m pretty sure we aren’t friends anymore :)

  40. MikeE September 22, 2009 at 9:55 pm #

    what ever happened with this… even if its not totally finished, having access to this program should provide some fun on rainy days.

    Kindly (re)consider posting the code/executable.

  41. nab November 25, 2010 at 12:14 pm #

    MosaicsMaker is a tool that transforms photos into LEGO mosaics. The LEGO mosaics creator permits you to upload a photo, crop it, change the colors and view online the result.

    You can buy these LEGO paintings pre assembled by us or in a puzzle like mode. A documentation is then provided.

    http://www.mosaicsmaker.com

    • Riyad Kalla December 1, 2010 at 10:14 pm #

      nab, thanks for the link for folks interested in this service.

  42. Factoring June 1, 2011 at 6:39 pm #

    It is the best time to make some plans for the future and it is time to be happy. I’ve read this post and if I could I desire to suggest you some interesting things or tips. Maybe you could write next articles referring to this article. I want to read even more things about it!

  43. Custom Saltwater Aquariums June 1, 2011 at 6:43 pm #

    Hi there, just became aware of your blog through Google, and found that it is really informative. I am gonna watch out for brussels. I will appreciate if you continue this in future. Many people will be benefited from your writing. Cheers!

  44. Lola June 23, 2011 at 1:24 pm #

    LEGOland in Chicago has the Scream and another painting made of LEGOs.

Trackbacks/Pingbacks

  1. sp4ngle » Blog Archive » What Google Engineers do for Fun: Computerized Lego Art Project | The “Break it Down” Blog - October 10, 2008

    [...] [...]

  2. Marginal Improvements Make People Happy - October 11, 2008

    [...] saw a recent post on Slashdot that got my attention – What Google Engineers do for Fun: Computerized Lego Art Project. I have to admit I am a total Lego nut so whenever I see Lego in the headline I have to read the [...]

  3. 5 WordPress Tips for Surviving Slashdot, Digg or Reddit | The "Break it Down" Blog - October 11, 2008

    [...] to on-the-fly setup directly cached pages. For example, as soon as we saw hits coming in for the Lego Algorithm story, we popped it into WP-Super-Cache and had it create a permanent cache of the page that it would [...]

  4. yorkhannah - October 11, 2008

    I’m daily more convinced that lego is what’s missing from my life. Retweetin @stretchyboy Currently Browsing: http://tinyurl.com/4ybom7

  5. Arjan`s World » LINKBLOG for October 12, 2008 - October 12, 2008

    [...] What Google Engineers do for Fun: Computerized Lego Art Project – “Break it Down” Blog [...]

  6. Go Miniman Go » Google + LEGO = Wall Art - October 14, 2008

    [...] LEGO brick sizes, and orientation to produce the original image done completely in LEGO bricks! Click here to read how Justin came up with the idea and check out some more awesome LEGO works of [...]

  7. links for 2008-10-21 | Yostivanich.com - October 21, 2008

    [...] What Google Engineers do for Fun: Computerized LEGO Art Project | The "Break it Down" Blog That's beyond cool. He used Java to look at photos and develop how to build the photo using Lego bricks. (tags: java lego google software programming technology diy art) [...]

  8. Bill Ward’s Brickpile » Blog Archive » What Google Engineers do for Fun: Computerized LEGO Art Project - October 23, 2008

    [...] What Google Engineers do for Fun: Computerized LEGO Art Project [...]

  9. jonathan_scott - May 13, 2009

    Now we know what Google engineers do 4 fun :-) http://is.gd/zsq8

Leave a Reply


+ 8 = 13