使用python 3.x 对pythonchallenge-----12的解答过程

pythonchallenge-10地址 : http://www.pythonchallenge.com/pc/return/evil.html
图片如下:

使用python 3.x 对pythonchallenge-----12的解答过程

题目解析: 查看源代码,图片地址为evil1.jpg  这个有点奇怪试着用evil2.jpg访问,出现一个图片,图片内容为not jpg  --.gfx
于是用evil2.gfx 访问链接,打开是一个乱码文件,用IE下载gfx文件
题目的意思就是将gfx文件分为5份,然后在图片中显示

解题过程:
# coding = utf-8
from PIL import Image,ImageFile
import io
ImageFile.LOAD_TRUNCATED_IMAGES = True
img = Image.new('RGBA',(3200,480))
path = r'./other/evil2.gfx'
f = open(path,'rb').read()

for i in range(5):
    im= open('./other/img'+str(i)+'.jpg','wb')
    im.write(f[i::5])
    im = Image.open('./other/img'+str(i)+'.jpg')
    print(im.size)
    img.paste(im,(i*640,0))

img.show()

答案:disproportional

使用python 3.x 对pythonchallenge-----12的解答过程