How are images stored in MakeCode Arcade?
An Arcade image stores a palette index for each pixel. Each index uses four bits and selects one of sixteen palette entries. Index zero is reserved for transparency, leaving fifteen visible colors. Microsoft documents this model in Art and Images. The editor above uses that default palette and lets you inspect the same value in three number systems.
Start with the original signal arrow. Move through its cells and read the inspector, then choose a brush index and change one pixel. Watch the text update. Your first goal is to explain why a small number can identify a color without containing the color’s full RGB value. You can do the whole exercise here without uploading an image, signing in, or opening a project.
Separate the file, the code, and the image
Think about three different objects when you convert artwork. A PNG or JPEG is a source file. The converter reads that file and produces image code. An img expression is readable source text that describes pixel values. The runtime image is the indexed picture used by the program. These are different representations, so their lengths and file sizes should not be treated as interchangeable measurements.
The official Image documentation shows image layouts written as rows of single-character pixels inside an img expression. A dot represents a transparent pixel; zero also denotes transparency. This page exports dots for zero. Spaces make the rows easier to read, and the surrounding expression lets you use the result as an image value in the Arcade JavaScript editor.
In this exercise, read each row from left to right and then move downward. The top-left cell is row one, column one in our inspector. Those classroom labels are one-based positions, not coordinates to paste into an API call. Counting deliberately helps partners describe the same pixel and catch a misplaced value before they argue about the drawing.
Read one index in three ways
Decimal, hexadecimal, and binary can describe the same number. Decimal uses digits zero through nine. Hexadecimal uses those digits followed by a, b, c, d, e, and f for ten through fifteen. Four binary places have weights eight, four, two, and one. For example, binary 1010 means eight plus two: decimal ten, written as hexadecimal a.
Use the inspector to test that calculation. Select brush index ten, paint one cell, and check all three readings. Then switch Text format to binary. Every pixel occupies a separate four-character group. Leading zeros matter in this display: decimal two appears as 0010, which keeps the four-place pattern visible. The format changes the notation while preserving the grid’s indices.
Try predicting the readings before looking. What decimal number does 1111 represent? Which single hex digit matches it? Next inspect a transparent cell. Its binary reading is 0000; the copied image expression writes a dot there. The checkerboard is this tool’s visual cue for transparency and is not another palette color stored in the image.
Keep an index separate from its color
An index identifies a palette slot. The slot supplies the displayed RGB color. In the default palette used here, index two is red, while index fifteen, hex f, is visible black. Transparent zero and visible black have different behavior even though the official default palette lists a black RGB placeholder for slot zero. Compare the arrow’s empty cells with its bottom-right black marker.
Changing a project palette can change how existing indices look, as described in Art and Images. This exercise keeps its palette fixed so partners can compare results. Use the palette editor when you want to explore project colors. Before discussing a different-looking sprite, check whether both people are using the same palette and the same pixel indices.
Decode, check, and repair
Choose your text format before editing. Enter exactly eight rows containing eight values each, separated by spaces. Hexadecimal mode also accepts compact rows and dots. Press Decode into grid to apply a complete valid image. Invalid input produces a row or column message where possible and leaves the previous grid intact. Switching formats replaces any unapplied draft with the current grid’s values.
For a useful debugging routine, compare one row at a time. First count its values. Then check whether each token belongs to the chosen notation. Finally compare the intended index with the inspector. A syntactically valid value can still be the wrong pixel: changing 2 to f passes hex validation but changes a red arrow cell into black. Validation cannot decide your artistic intention.
Estimate only the pixel payload
Use the four-bit model for a deliberately limited calculation: width times height times four, divided by eight, gives bytes of pixel payload. Our eight-by-eight exercise has sixty-four pixels, so its idealized payload is thirty-two bytes. That arithmetic excludes headers, alignment, objects, the palette, compression, and program overhead. It is not an exact RAM requirement, project download size, or source-text length.
The official hardware specification describes a standard 160 by 120 display and four-bit display data. Applying the same arithmetic gives 9,600 bytes for one screen’s pixel payload. A complete running game needs more than that single payload. Ask students to name what their estimate includes before comparing numbers; the question being measured matters as much as multiplication.
Run a short data-representation lesson
Allow about ten to fifteen minutes for students who already recognize sprite pixels. Begin with a prediction, work in pairs to decode the printed signal, introduce one deliberate error, and finish with a payload explanation. One student reads the values while the other checks positions; swap roles for the repair. The student sheet below supplies the tasks, and the teacher sheet gives separate answers.
Print each audience’s sheet with its own button. Regular browser printing defaults to the student activity. For an unplugged version, students can describe the arrow and mark the repair directly on the printed rows. Continue from the Sprite Lab when students are ready to explain their artwork as data, or use the image converter to inspect code produced from their own source images.
Student activity: Decode the signal
Name: ****____**** Partner: ****____****
Work from left to right, top to bottom. The positions below start at one. Use the default palette: 0 is transparent, 2 is red, and f is visible black. These are original exercises for this lesson.
0 0 0 2 0 0 0 0
0 0 0 2 2 0 0 0
0 0 0 2 2 2 0 0
2 2 2 2 2 2 2 0
2 2 2 2 2 2 2 0
0 0 0 2 2 2 0 0
0 0 0 2 2 0 0 0
0 0 0 2 0 0 0 f
- Predict and decode. What direction does the red signal point? Where is the visible black marker? Check with the editor if available.
- Encode one row. Rewrite row two as eight 4-bit binary groups. Explain why the groups use leading zeros.
- Repair a transmission. A partner received row four as
2 2 2 2 f 2 2 0. Identify the changed column. Write its intended decimal index, hex digit, and four bits. - Explain a value. Convert binary
1010to decimal and hex. Does that number alone specify an RGB color without knowing the palette? - Estimate the payload. Calculate
8 × 8 × 4 ÷ 8bytes. Then calculate the same model for 16 × 16 and 32 × 32. Name two things excluded from these estimates.
arcadeimageconverter.org/how-makecode-arcade-images-work · Student sheet
Teacher answers: Decode the signal
Suggested timing: prediction 2 minutes, decoding 4 minutes, repair 3 minutes, explanation and payload 3 minutes. Adapt for your class. Print this sheet separately from the student activity.
- Decode: The red arrow points right. Its visible black marker is row eight, column eight. Zero cells are transparent; the printed zeros are data, not visible black paint.
- Encode row two:
0000 0000 0000 0010 0010 0000 0000 0000. Each group shows four bit positions, including leading zeros. Reading the groups back gives0 0 0 2 2 0 0 0. - Repair: Row four, column five changed from
2tof. Restore decimal2, hex2, binary0010. Receivedfmeans decimal fifteen and binary1111. The received row is valid hex, so syntax checks alone cannot detect this mistake. - Explain:
1010is eight plus two, decimal10, hexa. It identifies a palette slot. The active palette supplies that slot’s RGB color; the index alone does not specify an independent RGB value. - Estimate: 8 × 8 gives 32 bytes; 16 × 16 gives 128 bytes; 32 × 32 gives 512 bytes in the four-bit pixel-payload model. Accept exclusions such as headers, alignment, palette, objects, compression, or program overhead. Reject claims that these are exact total RAM or download sizes.
Discussion and checking
Ask each pair to explain one valid-but-wrong value and one invalid token. For example, f in place of 2 is valid hex but changes the intended signal; g is invalid hex. Check that students distinguish decimal ten from hex ten: one hex digit a represents decimal ten, while this tool does not accept 10 as a single hex pixel.
Extension: change one transparent cell to visible black and explain both the changed index and the changed appearance. Use the inspector to verify the four bits. Students should retain their own copy if needed; reloading the exercise restores the original example.
arcadeimageconverter.org/how-makecode-arcade-images-work · Teacher sheet