Python Challenge[33]

[Level 33]


Title: 33 bottles of beer on the wall

最终从源码中得到 beer2.png。结合之前的提示

If you are blinded by the light,
remove its power, with its might.
Then from the ashes, fair and square,
another truth at you will glare.

嗯,没懂。去除亮点,剩余的数是平方数,重新组成图。

from PIL import Image
import math

with Image.open('beer2.png') as img:
  data = list(img.getdata())
for i in range(254, -1, -1):
  imgData = [d for d in data if d < i]
  x = math.sqrt(len(imgData))
  if x == int(x) and x > 0:
    newImg = Image.new('L', (int(x), int(x)))
    newImg.putdata(imgData)
    newImg.save('img/'+str(x)+'.png')

得到好多个字母,外边有方框的字母组成 gremlinsTemporary End

Python Challenge Wiki

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容