pythonchallenge Level 22

第22关地址:http://www.pythonchallenge.com/pc/hex/copper.html

  

查看源码

标题:emulate

提示:or maybe white.gif would be more bright

打开 http://www.pythonchallenge.com/pc/hex/white.gif

得到一张很黑图,处理下图片,这一段我也没看太明白

from PIL import Image,ImageDraw

im = Image.open("white.gif")
new = Image.new("RGB", im.size)
draw = ImageDraw.Draw(new)
cx, cy = 0, 100
for frame in range(133):
    im.seek(frame)
    left, upper, right, lower = im.getbbox()
    dx = (left - 100)//2
    dy = (upper - 100)//2
    if cx:
        draw.point([cx, cy])
    cx += dx
    cy += dy
    if dx == dy == 0:
        cx += 25
        cy = 100
new.save("bonus.png")

得到一张图

显示bonus

获得下一关地址:http://www.pythonchallenge.com/pc/hex/bonus.html

posted @ 2021-12-07 10:01  OTAKU_nicole  阅读(82)  评论(0编辑  收藏  举报