Challenge

A colorful PNG image consisting of solid-color rectangular blocks.

Approach

  1. Sample one pixel from each block to get its RGB value.
  2. Convert each (R, G, B) triple to an ASCII character: the RGB values are the ASCII codes of three consecutive characters.
  3. Read the blocks left-to-right, top-to-bottom.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
from PIL import Image

img = Image.open("disco_franklin.png").convert("RGB")
w, h = img.size
BLOCK = 50  # block size in pixels
flag = ""
for y in range(0, h, BLOCK):
    for x in range(0, w, BLOCK):
        r, g, b = img.getpixel((x + BLOCK//2, y + BLOCK//2))
        if r: flag += chr(r)
        if g: flag += chr(g)
        if b: flag += chr(b)
print(flag)

Flag

boroCTF{nEv3r_l0$e_YoU4_Be@t}