Why do I get rendering error when trying to converting WMF to PNG with python PIL?

1.4k Views Asked by At

I have tried to find a solution for converting a .WMF image file to .png, unfortunately I have not been able to render the .wmf file in pyhton (on a windows machine). Do anyone have a solution for this?

One of the simplest examples I have tried out is the following (Python 3.6):

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

But gets the error:

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

Thank you in advance

1

There are 1 best solutions below

0
sichrisy On

I am sorry for the "duplicate" of this issue. I resolved my problem by use of ImageMagick (did not resolve original question):

Solution from similar topic - https://stackoverflow.com/a/46058963/13767408