Created
March 3, 2014 09:10
-
-
Save scturtle/9321202 to your computer and use it in GitHub Desktop.
hack the image puzzle LEVEL2 of http://www.guokr.com/post/557047/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://five.flash-gear.com/npuz/puz.php?c=z&o=2&id=4349105&k=17041499&s=15&w=420&h=555&f_dm=five | |
data = open('puz.swf', 'rb').read() | |
mark = '\xff\xd8\xff\xe0\x00\x10JFIF' | |
t=data.split(mark) | |
for i, d in enumerate(t): | |
if 'CREATOR' in d: | |
open('%d.jpeg'%i, 'wb').write(mark + d) | |
from PIL import Image | |
import os | |
img = Image.new('RGB', (15*28+15, 15*37+15)) | |
for r in xrange(37): | |
for c in xrange(28): | |
name = '{}.jpeg'.format(r*28+c+1) | |
img.paste(Image.open(name), (c*15, r*15, c*15+30, r*15+30)) | |
os.remove(name) | |
img.save('origin.bmp') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment