gpt4 book ai didi

Python PIL 粘贴

转载 作者:太空狗 更新时间:2023-10-29 21:34:44 27 4
gpt4 key购买 nike

我想用 PIL 粘贴一堆图片。出于某种原因,当我运行 blank.paste(img,(i*128,j*128)) 行时,出现以下错误:ValueError: cannot determine region size;使用 4 项框

我试着弄乱它并使用一个包含 4 个元素的元组(例如(128,128,128,128)),但它给了我这个错误:SystemError: new style getargs format but argument is not a tuple

每张图片都是 128x,命名风格为“x_y.png”,其中 x 和 y 是从 0 到 39。我的代码如下。

from PIL import Image

loc = 'top right/'
blank = Image.new("RGB", (6000,6000), "white")

for x in range(40):
for y in reversed(range(40)):
file = str(x)+'_'+str(y)+'.png'
img = open(loc+file)
blank.paste(img,(x*128,y*128))

blank.save('top right.png')

我怎样才能让它工作?

最佳答案

这对我有用,我使用的是 Odoo v9 并且我有 pillow 4.0。

我在我的服务器上用 ubuntu 做了这一步:

# pip uninstall pillow
# pip install Pillow==3.4.2
# /etc/init.d/odoo restart

关于Python PIL 粘贴,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19486337/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com