Given a text file of 61366 lines with each line having values similar to
255,255,255
255,255,255
237,130,48
215,140,82
255,243,207
255,251,237
I could identify that those were RGB values for an image.
So initially I tried to find the resolution of the pic that will multiply to 61366
So initially I tried to find the resolution of the pic that will multiply to 61366
for i in range(0,1000): for j in range(0,1000): if i*j==61366: print i,"*",jI got the values to be 122 * 503, or 503*122.
So next thing was to create the image using Python Image Library. I used the CSV library to read from the input file.
import Image import csv img = Image.new( 'RGB', (503,122), "black") # create a new black image pixels = img.load() # create the pixel map f=open('flag.txt','r') reader = csv.reader(f, delimiter=',') mycsv = list(reader) k=0 for i in range(img.size[0]): # for every pixel: for j in range(img.size[1]): pixels[i,j] = (int(mycsv[k][0]), int(mycsv[k][1]), int(mycsv[k][2])) # set the colour accordingly k=k+1 img.show()and thus I got the image..
and thus the flag.
No comments:
Post a Comment