我试图执行ImageFont.truetype
。
您可以下载woff
文件here。
from PIL import Image, ImageDraw, ImageFont
font = ImageFont.truetype('89874f10.woff', 40)
但是,我收到以下错误消息。
Traceback (most recent call last):
File "<pyshell#64>", line 1, in <module>
font = ImageFont.truetype('89874f10.woff', 10)
File "C:\Program Files\Python38\lib\site-packages\PIL\ImageFont.py", line 642, in truetype
return freetype(font)
File "C:\Program Files\Python38\lib\site-packages\PIL\ImageFont.py", line 639, in freetype
return FreeTypeFont(font, size, index, encoding, layout_engine)
File "C:\Program Files\Python38\lib\site-packages\PIL\ImageFont.py", line 187, in __init__
self.font = core.getfont(
OSError: invalid argument
错误原因是什么?
如何解决问题?
非常感谢您。