Create Lego Images With GIMP

I came across this tutorial from a while back, but the website that it linked back to is no longer there, or no longer working. I thought I would re-post it as a public service. (All file links courtesy of


Virtual Lego Mosaic with GIMP

Visual summary of tutorial stepsA photo is first pixelized into square blocks of solid color and then impressed with a pattern of lego pieces which is the same size and shape as the square blocks. The lego brick pattern was obtained by digitizing a lego piece in a scanner.

This tutorial was written using the GIMP, but should apply to many image editors (see also Grokking the GIMP). Feel free to email me if you have any questions.

Lego is a registered trademark of the LEGO Group. This site is in no way endorsed by or affiliated with the LEGO Group.


Making a Virtual Lego Mosaic

Download both the lego stud and the highlight patterns. My patterns comes from a 1×1 flat lego brick; the final image will appear to be made up of these bricks. They are 20×20 pixels.

For GIMP: lego stud, highlight. Save both .pat files to the GIMP patterns directory (on Unix, ~/.gimp-2.4/patterns/ depending on the GIMP version):

Alternate PNG format: lego stud, highlight. Use an appropriate tool in your image editor to tile the pattern (e.g. Filters → Render → Map → Tile…).

initial image of sailboatpixelized image of sailboat

Next, open a photograph or any image in the GIMP. I’ve chosen a picture of a sailboat. Use Filters → Blur → Pixelize… to pixelize the image. This filter blurs the image into square blocks of solid colors. The size of the blocks chosen in the pixelize filter must be the same as the size of the Lego brick pattern; I pixelized to 20×20 because my lego brick pattern is 20×20 pixels.

lego pattern layer set to multiplyCreate a new layer, and use the Bucket Fill tool to fill with a pattern. Make sure the brick pattern is the current pattern. Double click on the Bucket Fill tool to bring up the Tool Options dialog. Choose “Pattern Fill”. Then select the entire new layer (Ctrl-a) and click to fill it with the pattern. Set the layer mode to “Multiply (Burn)” in the “Layers” dialog (Dialogs → Layers) so that the lego pattern is impressed into the image below. You may need to adjust the brightness of the original layer because multiplying tends to darken things.

The brick pattern appears, but the bricks aren’t quite as shiny as they should be.

highlight layer set to additionRepeat the above sequence, only this time fill a new layer with the “highlight” pattern. Set the layer mode to “Addition”, so only the white highlights show. You can adjust this layer’s opacity if the highlights are too bright; I used 30%.

I then usually use Colors → Posterize to reduce the number of colors in the pixelized image layer. This makes it more realistic as legos don’t come in very many colors. I use a value around 12 which is somewhere between too many and too few. You may also wish to make a palette of actual lego colors and only use those in the image. Doing that is left as an exercise to the reader

See the full finished example, another example (notice the illusion of pieces created with painstaking erasure of crevices).

Other Resources

Lugnet provides a Mosaic Maker tool that performs a similar operation. This tool is geared toward making a physical mosaic out of actual Lego bricks. As such, it allows one to select colors from those available in physical bricks. The color limitations often result in a poorer looking mosaic; that is a limitation of available Lego bricks.

Brick Arts appears to sell kits and pre-built mosaics. I have no idea if they are any good.

Bricklink is a good resource for purchasing quantities of bricks. I’ve used them in the past for small orders. Keep in mind that Bricklink is composed of individual sellers so positive experience doesn’t necessarily extend to all sellers.

Making the Lego Brick Pattern

scanned<br />
legosThe following steps are unecessary if you’ve downloaded the patterns above. But if you want a larger size or something different, you can start with the original source image.

I began by scanning the 1×1 brick surrounded by other bricks with my scanner. Care was taken to line up the bricks with the scanner so the straight edge of the brick didn’t create a jagged edge of pixels. Given the mechanics of my scanner, the bricks appear to have a light source from above casting shadows below.

The single brick was cropped, with the left and top edges of the selection touching the brick and the lower and right edges touching the neighboring brick and including the small black void between the bricks; when this pattern is repeated in a mosaic, the edges and crevices will match up correctly. I touched up the image and removed the “lego” printing with the airbrush and clone tools to avoid trademark issues. The brick was scaled to 20×20 pixels for the pattern size that I wanted.

cropped brick with corner detailThe brick was converted to grayscale (Colors → Desaturate). The Levels tool (Colors → Levels) was used to adjust the brightness, contrast, and gamma of the scanned brick to a fairly light color. If the brick pattern is too dark, white areas to appear gray in a virtual mosaic. This image was saved as the brick pattern.

brick pattern with brightness adjustmentA second application of the Levels tool was used to retain only the glossy reflection from the brick. This image was saved as the highlight pattern.

brick pattern glossy reflectionThe images were saved to ~/gimp-2.4/patterns/ as GIMP pattern files (.pat). This makes the two patterns available in the Patterns dialog (Dialogs → Patterns). It may be necessary to refresh the pattern list before you can select your new patterns.


You may also like...

Leave a Reply