2024-09-26 22:55:36 发布
网友
在图像查看器中打开图像时,显示的图像名称错误(与加载的图像不同)。原始图像图片.PNG'中的名称='tmpy4uvijg0.BMP'(新名称始终更改,请参见下图)
from PIL import Image imName='image.PNG' try: with Image.open(imName) as im: print(imName) im.show() except IOError: pass
image.pngnew image
我做错什么了?为什么名字不一样?你知道吗
这是因为show方法将图像保存到临时文件中,如文档中所述:
show
Displays this image. This method is mainly intended for debugging purposes.On Unix platforms, this method saves the image to a temporary PPM file, and calls the xv utility.On Windows, it saves the image to a temporary BMP file, and uses the standard BMP display utility to show it (usually Paint).:param title: Optional title to use for the image window, where possible.:param command: command used to show the image
Displays this image. This method is mainly intended for debugging purposes.
On Unix platforms, this method saves the image to a temporary PPM file, and calls the xv utility.
On Windows, it saves the image to a temporary BMP file, and uses the standard BMP display utility to show it (usually Paint).
:param title: Optional title to use for the image window, where possible.
:param command: command used to show the image
您可以尝试通过在参数中传递字符串来更改标题。你知道吗
这是因为
show
方法将图像保存到临时文件中,如文档中所述:您可以尝试通过在参数中传递字符串来更改标题。你知道吗
相关问题 更多 >
编程相关推荐