The flag is "encrypted" into the blue channel. Each pixel is made up of `red, green := randint(1,255), randint(1,255)`, with `blue := flag_char * red/256 * green/255 * 10``solve.py` simply solves for `c`, picking the most frequent (for all `out*.jpg` observations) occurence, in order to cancel out the random noice from `red` and `green`.
# solve.py```pythonfrom PIL import Image
# get observationschars = Nonefor i in range(1, 101):    img = Image.open("out"+str(i)+".png")    data = img.load()
    if not chars:        chars = []        for _ in range(img.width):            chars.append([])
    for i in range(img.width):        r, g, shit = data[i, 0]        c = (shit / (r/256 * g/256 * 10))        chars[i].append(c)
flag = []# use the most common candidatefor char in chars:    candidates = {}    for c in char:        c = round(c)        if c not in candidates:            candidates[c] = 0        candidates[c] += 1    most_frequent, frequency = None, 0    for candidate, freq in candidates.items():        if freq > frequency:            most_frequent, frequency = candidate, freq    flag.append(most_frequent)
print("".join(list(map(chr, flag))))```
Resulting in `"tpctf{i_c4nt_7h1nk_0f_a_fUnny_f14g_:(}"`
# encode.pycleaned version of `encode.py` (for reference):```import randomfrom PIL import Image
print(">>", [ord(c) for c in "REDACTED"])tries = []for i in range(1, 101):    chars = []
    flag = "REDACTED"    img = Image.new("RGB", (len(flag), 1), "white")    data = img.load()    i = 0    for c in flag:        c = ord(c)        r = random.randint(1, 256)        g = random.randint(1, 256)        data[i, 0] = (r, g, round(c*(r/256)*(g/256)*10))        i += 1        chars.append((r, g, round(c*(r/256)*(g/256)*10)))    tries.append(chars)    # img.save("out"+str(i)+".png")
print(tries[0])for ch in tries[0]:    r, g, shit = ch    print(chr(int(shit / (r/256 * g/256 * 10))))```