PIL Issue, OSError: cannot open resource

前端 未结 7 1791
野的像风
野的像风 2020-12-31 04:12

I\'m attempting to write a program that places text onto an image, I\'m trying to get my head round PIL and have run into the error: OSError: cannot open resource. This is m

相关标签:
7条回答
  • 2020-12-31 04:38

    I fixed the problem by using default font.

    font = ImageFont.load_default()
    

    If you just need to put some text (font style is not matter to you) then this might be a simple solution.

    font = ImageFont.load_default()
    
    draw = ImageDraw.Draw(pil_img)
    draw.text(( 20, 32), "text_string", (255,0,0), font=font)
    
    0 讨论(0)
提交回复
热议问题