Think in rows.
Each string is one row of the image. There are eight strings, each with eight digits. Position tells Python where the pixel goes.
Turn an 8 × 8 grid of numbers into a rocket you can download.
Try the project
Pick a palette and compare the pictures. Every pixel stays in the same place.
Moonlight palette
001221002 → window color8 rows × 8 pixelsEach string is one row of the image. There are eight strings, each with eight digits. Position tells Python where the pixel goes.
The outer loop picks a row. The inner loop looks up a color for each digit. In this drawing, 0 is the background and 2 is the window.
A new palette gives the same digits new colors. The rows still put each pixel in the same position. Download either version to keep the drawing.
The full script walks all eight rows and saves a PNG.
row = "00122100"
palette = ["background", "body", "window", "flame"]
for digit in row:
print(palette[int(digit)])python3 python-pixel-art.py --palette sunsetDownload the Python script ↓