Image.show(title=None, command=None)
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
either the xv utility or the display utility, depending on which one can be found.
On macOS, this method saves the image to a temporary BMP file, and opens it with
the native Preview application.
On Windows, it saves the image to a temporary BMP file, and uses the standard BMP
display utility to show it (usually Paint).
尝试保存图像并查看它。 我也不能直接从电脑上看到图像
但当我救了它
我能看到图像改变了。你知道吗
尝试使用
然后查看保存的图像。似乎alpha通道不适用于bmp或jpg文件。它是一个bmp文件,用
im.show()
显示(作为记录,我在mac上,我不知道
im.show()
是否在其他设备上使用不同的应用程序)。你知道吗正如@sanyam和@Pam所指出的,我们可以保存转换后的图像并正确显示。这是因为在Windows上,在使用系统默认图像查看器显示图像之前,图像会保存为临时BMP文件,如PIL documentation:
为了解决这个问题,我们可以将枕头代码修补为使用PNG格式作为默认格式。首先,我们需要找到枕头包装的根源:
在我的系统上,输出是:
转到这个目录并打开文件
ImageShow.py
。我在register(WindowsViewer)
行之后添加以下代码:在那之后,我可以用alpha通道正确地显示图像。你知道吗
参考文献
相关问题 更多 >
编程相关推荐