PNG2
[Reverse]
PNG2
In an effort to get rid of all of the bloat in the .png format, I'm proud to announce .PNG2! The first pixel is #7F7F7F, can you get the rest of the image?
- Download: utctf2020_img.png2
Recon
Layout of file pic.png2
:
$ xxd pic.png2 | head
00000000: 504e 4732 7769 6474 683d 05cf 6865 6967 PNG2width=..heig
00000010: 6874 3d02 887f 7f7f 7f7f 7f7f 7f7f 7f7f ht=.............
00000020: 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f ................
00000030: 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f ................
00000040: 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f ................
00000050: 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f ................
00000060: 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f ................
00000070: 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f ................
00000080: 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f ................
00000090: 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f ................
We notice a width of 0x5cf and a height of 0x288, and then possible the color codes of the pixels.
Code
import numpy as np
import scipy.misc as smp
with open ("pic.png2", "r") as f:
data = f.read()
image = np.zeros( (1487, 648, 3), dtype = np.uint8 )
x=0
y=0
for i in range (21, len(data), 3):
red = int(data[i].encode("hex"), 16)
blue = int(data[i+1].encode("hex"), 16)
green = int(data[i+1].encode("hex"), 16)
image[x,y] = [red, blue, green]
x += 1
if x>=1487:
x=0
y+=1
im = smp.toimage( image )
im.save("solve.png")
Flag
utflag{j139adfo_93u12hfaj}