gpt4 book ai didi

Python - 将两个 Tif 文件附加到特定文件中

转载 作者:行者123 更新时间:2023-12-01 08:43:29 24 4
gpt4 key购买 nike

Python - 将两个 TIF 文件附加到特定文件

我的要求是将两个单分页器 TIF 文件附加到具有两页的单个 TIF 文件中。我知道存在append_images参数并尝试按如下方式实现它:

img1 = Image.open(open("file1.tif", 'rb'))
img2 = Image.open(open(“file2.tif", 'rb'))
img1.seek(0)
img1.save(output.tif,save_all=True,append_images=img1)

以上代码导致 TypeError: TiffImageFile' object is not iterable.

任何人都可以建议一种将两个文件附加到单个文件中的方法吗?

最佳答案

因为 append_images 需要一个数组,请尝试:

img1.save(output.tif,save_all=True,append_images=[img1])

希望有帮助!

关于Python - 将两个 Tif 文件附加到特定文件中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53398032/

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