Download the log file for canvas (check the pinned post as well in case the link changes)

Grab this snippet of code from Github (if you don’t understand this code please DO NOT run it. Never run random code you grabbed from the internet if you can’t read it :P)

Make sure you have Python and Python Pillow installed.

Change these variables to suite your needs

users = None
instances = None

The default None is actually “show me everything”, I’m just bad at naming things.

E.g. I want to see the top 10 combined pixel placers, I would

 users = "guantousam@lemmy.world \
         ShadowGlider@lemmy.world \
         DragonM97HD@lemmy.world \
         Lokloy@lemmy.world \
         DJSoundwav3@lemmy.world \
         ubermeisters@lemmy.world \
         peter_pangolin@toast.ooo \
         Bottom@lemm.ee \
         NanoPi@lemmy.world \
         akq@lemm.ee"

and set the instances to None

This would output this image

You can also set it to show pixels after a certain timestamp (although I haven’t tested that properly)

Source code if you don’t want to go to gist

spoiler
    This is free and unencumbered software released into the public domain.

    Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

    In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    For more information, please refer to <http://unlicense.org/>

from PIL import Image, ImageDraw
from datetime import datetime

# Get yours here https://cdn.sc07.company/canvas/2023/pixels.log.txt
log_filename = 'pixels.log.txt'

# Show pixles after this unix timestamp
start_time = 0

# Show specific users (example top 10 pixel placers)
# users = "guantousam@lemmy.world \
#         ShadowGlider@lemmy.world \
#         DragonM97HD@lemmy.world \
#         Lokloy@lemmy.world \
#         DJSoundwav3@lemmy.world \
#         ubermeisters@lemmy.world \
#         peter_pangolin@toast.ooo \
#         Bottom@lemm.ee \
#         NanoPi@lemmy.world \
#         akq@lemm.ee"
# None specified will show ALL
# CASE SENSITIVE!!!
users = None

# Instances. None specified will show ALL instances
# Example, only show blahaj and lemmy.zip
# instances = "lemmy.blahaj.zone lemmy.zip"
instances = None

# Color palette dictionary
color_palette = {
    0: "000000",
    1: "222222",
    2: "555555",
    3: "888888",
    4: "CDCDCD",
    5: "FFFFFF",
    6: "FFD5BC",
    7: "FFB783",
    8: "B66D3D",
    9: "77431F",
    10: "FC7510",
    11: "FCA80E",
    12: "FDE817",
    13: "FFF491",
    14: "BEFF40",
    15: "70DD13",
    16: "31A117",
    17: "0B5F35",
    18: "277E6C",
    19: "32B69F",
    20: "88FFF3",
    21: "24B5FE",
    22: "125CC7",
    23: "262960",
    24: "8B2FA8",
    25: "D24CE9",
    26: "FF59EF",
    27: "FFA9D9",
    28: "FF6474",
    29: "F02523",
    30: "B11206",
    31: "740C00"
}

# Function to convert hex color to RGB tuple
def hex_to_rgb(hex_color: str) -> tuple[int, int, int]:
    return tuple(int(hex_color[i:i+2], 16) for i in (0, 2, 4))


# Mapping pallet index to RGB color values
color_mapping = {index: hex_to_rgb(hex_color) for index, hex_color in color_palette.items()}

# Read log
def read_log_entries(filename: str) -> list[tuple]:
    log_entries = []
    with open(filename, 'r') as log_file:
        for line in log_file:
            parts = line.strip().split('\t')
            timestamp = parts[0]
            user = parts[1]
            x_coord = int(parts[2])
            y_coord = int(parts[3])
            color = int(parts[4])
            action = parts[5]
            log_entries.append((timestamp, user, x_coord, y_coord, color, action))
    return log_entries


def filter_pixels(actions: str, start_time: int, users = None, instances = None):
    log_entries = read_log_entries(log_filename)
    pixel_actions = {}
    for entry in log_entries:
        timestamp, user, x_coord, y_coord, color, action = entry
        if start_time == 0 or datetime.strptime(timestamp, '%Y-%m-%d %H:%M:%S,%f') > datetime.fromtimestamp(start_time):
            if not users or user in users:
                if not instances or user.split("@")[-1] in instances:
                    if action == actions:
                        pixel_actions[(x_coord, y_coord)] = (user, color_mapping[color], timestamp)
    return pixel_actions


def draw_pixels(pixels, output: str) -> None:
    image_size = (1000, 1000)
    image = Image.new("RGB", image_size, "white")
    draw = ImageDraw.Draw(image)

    for pixel, (user, color, _) in pixels.items():
        x, y = pixel
        draw.point((x, y), fill=color)

    image.save(output)


draw_pixels(filter_pixels("user place", start_time, users, instances), "output_image.png")