Bitmap to Blocks

Bitmap to Minecraft with Python and JavaScript

How could I draw an image in Minecraft from a file? Since MakeCode for Minecraft cannot access the file system as far as I know, the best way to do this is to process the image first and import the string of RGB values to Minecraft by pasting in JavaScript.

The first version of this program takes the raw RGB output and averages it to find an average lightness value, then chooses one of 4 blocks (black, grey, light grey, and white) based on dividing this value by 256 and using the rounded result as the index of MakeCode's block array.

monalisa.png

This program is less efficient than my later, color version because the Python script exports the raw RGB values as a flattened list, which requires more code in Code Connection to parse. I decided to simplify my MakeCode script and instruct the Python program to export just the list of block indices for MakeCode. That way all MakeCode needs to do is draw the block from its block array.

To do color, I processed the image using a Python script that calculated the distance from the pixel itself and a predetermined list of RGB values that each correspond to a block in Minecraft. For this, I referenced a color chart (https://www.w3schools.com/colors/colors_picker.asp) to estimate the RGB values of the various colored concrete bricks in Minecraft and compared these values, stored in an array, to the value of each pixel in the image. Additionally, the brick reference array contained a fourth value that was the index of the brick array in MakeCode for Minecraft. My terminal output (the 4th item in each block tuple) was pasted into JavaScript, and then the image was drawn line by line. For this, I used the Pillow fork of the Python Image Library (PIL) and Preview to resize my images. Here is the script:

In [1]:
from PIL import Image
import math
im = Image.open('mc/monalisa.jpg', 'r')
pix_val = list(im.getdata())
#white, orange, magenta, light blue, yellow, lime, pink, dark grey, light grey, cyan, purple, blue, brown, green, red, black
color_array = [(255, 255, 255, 0), (255, 102, 0, 1), (204, 0, 153, 2), (0, 204, 255, 3), (255, 204, 102, 4), (0, 204, 0, 5), (255, 102, 153, 6), (77, 77, 77, 7), (166, 166, 166, 8), (0, 153, 153, 9), (102, 0, 204, 10), (0, 0, 153, 11), (102, 51, 0, 12), (51, 102, 0, 13), (153, 0, 0, 14), (0, 0, 0, 15)]
pix_array = []
for pixel in pix_val:
 current_best = 1000
 for color in color_array:
  distance = math.sqrt((color[0] - pixel[0])**2 + (color[1] - pixel[1])**2 + (color[2] - pixel[2])**2)
  if distance < current_best:
   current_best = distance
   best_color = color[3]
 pix_array.append(best_color)
print(pix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 1, 4, 8, 7, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 12, 12, 15, 12, 7, 8, 4, 1, 4, 1, 1, 7, 1, 1, 1, 1, 1, 1, 4, 4, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 4, 1, 4, 4, 1, 4, 7, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 7, 8, 4, 1, 4, 4, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 4, 4, 1, 4, 4, 8, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 7, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 4, 1, 1, 4, 4, 4, 7, 12, 12, 12, 12, 1, 1, 1, 1, 1, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 12, 8, 1, 4, 4, 1, 4, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 4, 4, 4, 4, 4, 8, 12, 12, 12, 1, 4, 4, 4, 4, 4, 1, 1, 1, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 12, 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7, 12, 12, 1, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 12, 12, 12, 15, 15, 15, 15, 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, 4, 4, 4, 4, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 12, 12, 12, 15, 7, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 7, 12, 7, 7, 7, 7, 7, 7, 7, 7, 7, 4, 4, 4, 4, 4, 1, 12, 7, 1, 7, 12, 7, 8, 8, 4, 4, 4, 4, 4, 4, 4, 4, 12, 12, 12, 15, 7, 1, 1, 1, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 7, 12, 12, 7, 7, 7, 7, 7, 7, 12, 7, 1, 4, 4, 4, 4, 7, 12, 7, 7, 12, 7, 7, 7, 7, 7, 4, 4, 4, 4, 4, 4, 8, 12, 12, 12, 15, 12, 12, 12, 12, 12, 4, 4, 1, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 7, 7, 7, 7, 7, 12, 7, 7, 4, 4, 4, 4, 7, 12, 12, 12, 12, 12, 12, 12, 7, 12, 7, 4, 4, 4, 4, 4, 7, 12, 12, 12, 15, 12, 12, 12, 12, 12, 1, 4, 1, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 7, 7, 7, 7, 12, 7, 12, 4, 4, 4, 4, 7, 12, 12, 7, 12, 12, 12, 7, 7, 12, 7, 4, 4, 4, 4, 1, 7, 12, 12, 12, 15, 12, 12, 12, 12, 12, 12, 4, 1, 12, 12, 1, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 7, 7, 7, 12, 12, 12, 12, 1, 4, 4, 4, 7, 7, 7, 7, 12, 12, 12, 12, 7, 12, 8, 8, 7, 12, 12, 7, 7, 12, 12, 12, 12, 7, 1, 1, 12, 12, 1, 4, 1, 12, 1, 1, 4, 12, 12, 1, 1, 1, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 7, 12, 7, 7, 12, 12, 12, 7, 4, 4, 4, 7, 7, 12, 7, 12, 12, 7, 7, 7, 12, 7, 7, 12, 12, 12, 7, 12, 12, 12, 15, 12, 1, 4, 1, 1, 1, 1, 4, 1, 12, 1, 1, 1, 1, 1, 1, 1, 1, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 7, 7, 7, 12, 12, 12, 12, 7, 4, 4, 1, 7, 7, 12, 12, 12, 7, 7, 12, 7, 12, 12, 12, 12, 7, 12, 7, 12, 12, 12, 15, 15, 1, 4, 4, 4, 4, 1, 4, 1, 1, 1, 4, 4, 4, 4, 1, 1, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 8, 4, 1, 12, 12, 7, 12, 12, 7, 7, 12, 7, 12, 12, 12, 12, 7, 12, 12, 12, 12, 12, 12, 15, 12, 1, 4, 4, 1, 4, 4, 1, 1, 1, 1, 4, 4, 1, 1, 1, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 7, 7, 12, 12, 7, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 12, 12, 12, 12, 12, 15, 12, 4, 4, 4, 1, 4, 4, 1, 12, 1, 1, 1, 4, 1, 1, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 12, 7, 7, 7, 7, 7, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 12, 12, 15, 12, 1, 1, 1, 1, 4, 4, 12, 12, 1, 4, 1, 1, 1, 1, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 13, 7, 7, 7, 7, 7, 7, 7, 12, 12, 12, 12, 7, 7, 7, 7, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 12, 15, 15, 12, 12, 1, 1, 1, 1, 12, 12, 12, 12, 4, 4, 1, 1, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 12, 13, 7, 7, 7, 12, 7, 7, 12, 12, 7, 7, 7, 7, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 12, 12, 1, 1, 4, 1, 12, 12, 12, 12, 1, 1, 1, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 13, 13, 7, 7, 12, 12, 12, 12, 12, 12, 12, 12, 7, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 1, 1, 4, 12, 12, 12, 12, 12, 12, 1, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 12, 13, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 12, 15, 15, 12, 12, 1, 12, 1, 12, 12, 12, 12, 12, 1, 1, 1, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 7, 12, 15, 15, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 7, 7, 15, 12, 12, 15, 15, 12, 7, 1, 4, 1, 1, 1, 12, 12, 12, 1, 1, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 12, 12, 1, 1, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 7, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 12, 12, 4, 4, 4, 1, 1, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 7, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 12, 15, 15, 15, 15, 15, 12, 1, 4, 4, 1, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 7, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 7, 12, 12, 12, 15, 15, 15, 15, 15, 15, 12, 12, 1, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 12, 12, 12, 12, 12, 12, 12, 7, 7, 7, 7, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 15, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 7, 12, 12, 12, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 15, 15, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 12, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 7, 12, 12, 12, 15, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 7, 7, 7, 12, 15, 15, 12, 15, 15, 12, 12, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 7, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 7, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 7, 7, 12, 7, 7, 12, 12, 12, 12, 12, 12, 7, 7, 12, 7, 7, 12, 12, 7, 7, 7, 7, 7, 7, 7, 7, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 7, 1, 1, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 12, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 7, 7, 12, 12, 12, 7, 7, 7, 12, 12, 12, 12, 12, 15, 12, 7, 7, 12, 7, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 1, 1, 1, 12, 12, 12, 12, 1, 1, 12, 12, 12, 12, 15, 15, 15, 15, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 7, 12, 15, 12, 7, 7, 7, 7, 7, 12, 12, 12, 12, 7, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 12, 12, 12, 12, 12, 12, 15, 12, 15, 15, 15, 15, 15, 15, 15, 12, 15, 12, 15, 15, 15, 12, 12, 12, 12, 7, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 12, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 12, 12, 12, 7, 7, 12, 12, 7, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 7, 7, 12, 12, 12, 12, 12, 12, 12, 12, 12, 7, 12, 12, 15, 15, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 7, 12, 12, 12, 15, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 7, 7, 7, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 12, 15, 15, 15, 15, 15, 12, 12, 12, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 12, 12, 12, 15, 15, 15, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 12, 12, 12, 12, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 12, 12, 12, 12, 12, 15, 15, 15, 15, 12, 7, 12, 12, 12, 15, 15, 15, 12, 12, 12, 12, 12, 12, 12, 7, 7, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 12, 12, 12, 12, 12, 12, 15, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 12, 7, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 12, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 12, 12, 12, 15, 12, 12, 12, 7, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 12, 12, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 12, 12, 12, 12, 12, 12, 12, 12, 12, 7, 7, 7, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 12, 12, 7, 7, 12, 15, 15, 15, 15, 15, 15, 15, 12, 12, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 12, 12, 12, 12, 12, 12, 12, 7, 7, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 12, 12, 7, 12, 15, 15, 15, 15, 15, 15, 15, 12, 12, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 12, 12, 12, 7, 7, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 12, 12, 12, 12, 12, 12, 12, 15, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 7, 7, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 1, 1, 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 12, 12, 12, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 7, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 1, 1, 1, 4, 4, 4, 1, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 7, 12, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 15, 7, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 7, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 7, 12, 12, 12, 15, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 12, 15, 15, 15, 15, 12, 15, 15, 12, 7, 7, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 12, 12, 15, 12, 15, 12, 7, 12, 15, 12, 15, 15, 15, 15, 15, 15, 15, 15]

In the MakeCode JavaScript below, pixlist is left empty (these are the output of pix_array above). As of right now you must use the web editor, download the file, and then load it into Code Connection because Code Connection doesn't let you paste :( Also, this code (from "Starry Night") has a width of 96 and a height of 64. Note that in line 14 the conditional is 95 < x, not 96 < x

let block_type = 0
let pixlist: number[] = []
let color_array: number[] = []
let y = 0
let x = 0
player.onChat("run", function () {
  x = 0
  y = 64
  color_array = [blocks.block(Block.WhiteConcrete), blocks.block(Block.OrangeConcrete), blocks.block(Block.MagentaConcrete), blocks.block(Block.LightBlueConcrete), blocks.block(Block.YellowConcrete), blocks.block(Block.LimeConcrete), blocks.block(Block.PinkConcrete), blocks.block(Block.GrayConcrete), blocks.block(Block.LightGrayConcrete), blocks.block(Block.CyanConcrete), blocks.block(Block.PurpleConcrete), blocks.block(Block.BlueConcrete), blocks.block(Block.BrownConcrete), blocks.block(Block.GreenConcrete), blocks.block(Block.RedConcrete), blocks.block(Block.BlackConcrete)]
  pixlist = []
  for (let value of pixlist) {
    block_type = color_array[value]
    blocks.place(block_type, positions.create(x, y, 0))
    if (95 < x) {
      x = 0
      y += -1
      }
    x += 1
    }
})

gallery1.png

From left to right: Vincent Van Gogh's Starry Night, Leonardo Di Vinci's Mona Lisa, and Edvard Munch's Scream

monacolor.png scream.png gallery2.png