Creates a list of bricks to build any image as a Lego mural
Takes any image, pixelates it, and then finds the closest Lego brick color for each pixel. Outputs a list of Lego bricks required to build that mural, filtered by brick colors available in a certain year.
![](projects/image-to-lego/screenshots/1-input.png)
![](projects/image-to-lego/screenshots/1-output.png)
![](projects/image-to-lego/screenshots/2-input.png)
![](projects/image-to-lego/screenshots/2-output.png)
![](projects/image-to-lego/screenshots/3-input.png)
![](projects/image-to-lego/screenshots/3-output.png)
{
"counts": {
"columns": 52,
"rows": 72,
"bricks": 3687,
"colors": {
"Red": 13,
"Medium Nougat": 255,
"Lavender": 7,
"Bright Pink": 1,
"Bright Light Yellow": 4,
"Lime": 14,
"Dark Green": 5,
"Yellowish Green": 12,
"Yellow": 2,
"Neon Yellow": 2,
"Light Nougat": 1,
"Light Bluish Gray": 14,
"White": 2,
"Light Aqua": 1,
"Nougat": 4
}
},
"bricks": [
{
"originalColor": "5A1D08",
"nearestLegoColor": {
"match": {
"id": "59",
"name": "Dark Red",
"hex": "6A0E15",
"available": {
"start": "1961",
"end": "2023"
}
},
"distance": 25.495097567963924
}
},
{
"originalColor": "5F210A",
"nearestLegoColor": {
"match": {
"id": "59",
"name": "Dark Red",
"hex": "6A0E15",
"available": {
"start": "1961",
"end": "2023"
}
},
"distance": 24.55605831561735
}
},
{
"originalColor": "63250C",
"nearestLegoColor": {
"match": {
"id": "59",
"name": "Dark Red",
"hex": "6A0E15",
"available": {
"start": "1961",
"end": "2023"
}
},
"distance": 25.67099530598687
}
}
]
}