使用python 3.x 对pythonchallenge-----11的解答过程
2017-09-18 15:52 太烦人 阅读(312) 评论(0) 编辑 收藏 举报pythonchallenge-11地址 : http://www.pythonchallenge.com/pc/return/5808.html
图片如下:
题目解析:标题odd even->奇偶 猜测PythonChallenge是要我们把图片按奇偶行、奇偶列拆开为两幅图画
解题过程:
#http://www.pythonchallenge.com/pc/return/5808.html from PIL import Image import time path = r'./other/cave.jpg' white =(255,255,255) black = (0,0,0) img = Image.open(path) im = Image.new("RGBA",(350,300),(255,255,255)) img_array = im.load() n = 0 for i in range(2,640): m = 0 for j in range(2,480): if ((i%2 == 0) and (j%2 ==0)): color = img.getpixel((i,j)) img_array[i/2,j/2] = color m = m + 1 n = n + 1 im.show()
答案:在图片右上角可以隐约看到 evil