Skip to content

Unable to use NotoColorEmoji: invalid pixel size #6166

@jdhao

Description

@jdhao

What did you do?

I am trying to use NotoColorEmoji font from here.
Here is my code:

from PIL import ImageFont

FONT_PATH = './NotoColorEmoji.ttf'
font_size = 20
font = ImageFont.truetype(FONT_PATH, size=font_size)

What did you expect to happen?

I can open the font without error.

What actually happened?

I am seeing the following error:

     font = ImageFont.truetype(FONT_PATH, size=font_size)
   File "/home/jdhao/tools/miniconda/lib/python3.7/site-packages/PIL/ImageFont.py", line 844, in truetype
     return freetype(font)
   File "/home/jdhao/tools/miniconda/lib/python3.7/site-packages/PIL/ImageFont.py", line 841, in freetype
     return FreeTypeFont(font, size, index, encoding, layout_engine)
   File "/home/jdhao/tools/miniconda/lib/python3.7/site-packages/PIL/ImageFont.py", line 194, in __init__
     font, size, index, encoding, layout_engine=layout_engine
 OSError: invalid pixel size

What are your OS, Python and Pillow versions?

  • OS: CentOS 7.4
  • Python: 3.7.6
  • Pillow: 9.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions