猫史档案馆


【Python作品分享】长隆【作品秀】

用户:天天练编程的我天天练编程的我查看:0 回复:0 评论:0 创建时间:2021-07-16T20:58:34


【作品展示】

center_image

 

【作品介绍】

把长隆利用图片绘制出来

 

【作品源代码】

from PIL import Image
#
bg = Image.open('长隆.png').convert('RGBA')
pic = Image.open('fish.png').convert('RGBA')

# print(pic.getpixel((0,0)))

width, hight = pic.size
bg = bg.resize((1000,1000))
# print(width,height)
#
# pic_pixel = []
for y in range(hight):
    #
    # row = []
    for x in range(width):
        #
        RGB_Value = pic.getpixel((x, y))
        # if RGB_Value == (0,255,0):
        if sum(RGB_Value)/4 > 220:
            pic.putpixel((x, y), (255, 255, 255, 0))
# pic.show()
# print((0,255,0) in list(pic.getdata()))
bg.paste(pic, (0, 0), pic)
bg.show()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页