#πŸ”’ Fail to write emojis using custom Font

8 messages Β· Page 1 of 1 (latest)

safe sluice
#

I am currently trying to write text with colourful emoji using pillow, but everytime I used it, I always got a blank image
code:

from PIL import Image, ImageDraw, ImageFont

back_ground_color = (50, 50, 50)

unicode_text = u"😁"
im = Image.new("RGB", (500, 500), back_ground_color)
draw = ImageDraw.Draw(im)


font_info = {'test': [r"./NotoColorEmoji.ttf", 30]}

pos = [(100, 10), (50, 40), (50, 160), (100, 320)]

for i, item in enumerate(font_info.items()):
    path, size = item[1]
    font = ImageFont.truetype(path, size)
    draw.text(pos[i], unicode_text, font=font, embedded_color=True)

im.save("output.png")```
hollow quiverBOT
#

@safe sluice

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

safe sluice
#

I've tried this ofr an hour and still get the same results

#
from PIL import Image, ImageDraw, ImageFont

im = Image.new("RGB", (500, 500), (50, 50, 50))
draw = ImageDraw.Draw(im)

font_path = "Symbola.ttf"  
font_size = 100
font = ImageFont.truetype(font_path, font_size)

draw.text((100, 100), "😁", font=font, fill=(255, 255, 255))

im.save("output.png")```
this issue doesn't happen, if i don't use NotoColorEmoji.ttf
#

I managed to fix it?

#

woa

hollow quiverBOT
#

@safe sluice

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.