![](/img/trans.png)
[英]How I can load a font file with PIL.ImageFont.truetype without specifying the absolute path?
[英]How to specify font style path in PIL.ImageFont.truetype(), while coding in google colab?
text=data1
img = PIL.Image.new('RGBA',(1000,1500),'white')
draw = PIL.ImageDraw.Draw(img)
font = PIL.ImageFont.truetype('Arial.ttf', 16)
draw.text((0, 0), text, fill="black",font=font)
img.save(f"{name1}_{class1}.png")
在 Google colab 中編碼時,我不知道如何在此處指定字體樣式的路徑
font = PIL.ImageFont.truetype('Arial.ttf', 16)
它給了我錯誤,
無法打開資源
我使用 Samsung galaxy tab a 在 google colab 中編碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.