# 导图片入工具包
from PIL import Image
def getchar(gray):
return '@'if gray > 128 else ' '
name = 'a.jpg'
width,height = 80,48
img = Image.open(name).resize((width,height)).convert('L')
# print(img)
text = ''
for y in range(height):
for x in range(width):
print(img.getpixel((x,y)))
text += getchar(img.getpixel((x,y)))
text = "\n"
print(text)
f = open("helokitty.txt", "w")
f.write(text)
f.close()
alex-转字符画
猜你喜欢
转载自blog.csdn.net/houlaos/article/details/105396692
今日推荐
周排行