'Getting OS error on NotoColorEmoji font using Python Pillow

I am trying to use NotoColorEmoji font. But Getting OS error when I run the code. I am not sure why its happening.

Here is my code :

from PIL import ImageFont

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

Here is the error that I found :

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

Anyone can help on this issue? Your help will be much appreciated. Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source