【发布时间】:2020-07-11 16:00:04
【问题描述】:
我试图执行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
错误的原因是什么?
如何解决问题?
非常感谢。
【问题讨论】:
标签: python python-imaging-library truetype woff