我正在使用Python笔记本。其中,我有创建图像的代码,并且正在使用image.show()
进行调试。但是,这样做的缺点是,我无法为图像命名,因为它具有临时文件名。然后,我使用image.save("name.png")
以不同的名称保存图像,然后使用Image.open("name.png")
来打开它。然而,当我这样做时,实际上只打开了最后一个图像。我需要做些什么才能调用Image.open打开多个图像并将它们全部打开?例如,如果我执行以下操作:
image = Image.fromarray( ... )
image.save("original.png")
Image.open("original.png")
image = Image.fromarray( ... )
image.save("reconstruction.png")
Image.open("reconstruction.png")
仅"reconstruction.png"显示。
如果我在它们后面使用Image.show()
image = Image.fromarray( ... )
image.show()
image = Image.fromarray( ... )
image.show()
它可以工作,但他们会有暂时的名称,这些名称毫无意义,如果我最终拥有7-8个打开的图像,我希望有一种简单的方法来跟踪每个图像。
Image.open(temporary_name)
?你的问题不清楚。请展示代码。 - furas打开
一个文件时,你需要将其赋值给某个变量,以便稍后使用。根据你提供的代码,我不知道你如何让show
函数工作起来的。 - Mark Ransom