←  back to projects list

Image to Lego Art Converter

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.
#lego #github
{
    "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
            }
        }
    ]
}