Python Challenge level 11: “odd even”

Level 11 requires playing with images once again.

Fact 1: the image cave.jpg seems to have half ot its pixels blanked
We’ll assume odd and even pixels belong to different images. This snippet will put me out of my misery and let me know ;)

import Image
src = Image.open("cave.jpg")
w,h = src.size[0], src.size[1]
print "Image info:",src.format, src.size, src.mode
new = Image.new(src.mode,(w//2, h))

for i in range(w*h):
    y, x = divmod(i, w)
    p = src.getpixel((x,y))
    if i%2: #even==info, odd==photo
        new.putpixel((x/2,y/2+h//2),p)
    else:
        new.putpixel((x/2,y/2),p)
new.save('11.jpg')

Now it’s readable. “evil“. Next is Level 12.

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

1 Comment »

 
  • gohst says:

    open cave.jpg whit acdsee and zoom out 6x ,the word “evil” will come out .

 

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>