猫史档案馆


【Python作品分享】新的作品-43-副本-副本【作业帖】

用户:xs一马当先xs一马当先查看:1 回复:1 评论:1 创建时间:2022-08-05T18:53:37


【作品展示】

center_image

 

【作品介绍】

嗨害嗨

 

【作品源代码】

import os
from PIL import Image
import matplotlib.pyplot as plt
myDir = 'BCM'
files = os.listdir(myDir)
images_ext = [".png",".jpg",".bmp","jpeg",".gif"]
images = []
for file in files:
    name, ext = os.path.splitext(file)
    if ext in images_ext and 'bcm' in name:
        img = Image.open(myDir+os.sep+file)
        _img = img.resize((300,300))
        images.append(_img)
print(images)
board = Image.new('RGBA', (300, 300*len(images)))
for i in range(len(images)):
    board.paste(images[i],(0,300*i))
plt.imshow(board)
plt.show()
board.save('long.png')

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
黑客熊猫黑客熊猫

牛啊

点赞0


评论