码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2017-09-18 16:17:38      阅读:214      评论:0      收藏:0      [点我收藏+]

标签:style   --   目的   odi   utf-8   分享   乱码   read   write   

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

技术分享

题目解析: 查看源代码,图片地址为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的解答过程

标签:style   --   目的   odi   utf-8   分享   乱码   read   write   

原文地址:http://www.cnblogs.com/yinsjun/p/7543569.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!