为什么在尝试使用python PIL将WMF转换为PNG时会出现渲染错误?

2024-05-23 21:32:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图找到将.WMF图像文件转换为.png的解决方案,但不幸的是,我无法在pyhton(windows计算机上)中呈现.WMF文件。有人能解决这个问题吗

我尝试过的最简单的示例之一是以下(Python 3.6):

from PIL import Image  
Image.open("test.wmf").save("test.png")

但是得到了错误:

File "C:\Python36\lib\site-packages\PIL\WmfImagePlugin.py", line 58, in load
    Image.core.drawwmf(im.fp.read(), im.size, self.bbox),
OSError: cannot render metafile

先谢谢你


Tags: 文件fromtestimageimport示例pyhtonpil