【问题标题】:Python - Appending of two Tif files into specific filePython - 将两个 Tif 文件附加到特定文件中
【发布时间】:2018-11-20 17:06:39
【问题描述】:

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.

谁能建议一种将两个文件附加到单个文件中的方法?

【问题讨论】:

    标签: python python-imaging-library tiff


    【解决方案1】:

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

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

    希望对你有帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-18
      • 1970-01-01
      • 2011-07-27
      • 1970-01-01
      • 1970-01-01
      • 2012-06-23
      • 1970-01-01
      相关资源
      最近更新 更多