Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insert colorful emoji into an image(Python)

I am trying to insert emoji into an image using pillow library but the result is not what I want.

I want the emoji look exactly the same as it looks in iphone, but the result is a black and white ugly emoji.

this is my code:

from PIL import Image, ImageDraw, ImageFont

back_ground_color = (255, 255, 255)
font_color = (0, 0, 0)

unicode_text = u"\U0001f618"
im = Image.new("RGB", (200, 200), back_ground_color)
draw = ImageDraw.Draw(im)
unicode_font = ImageFont.truetype("Symbola.ttf", 36)
draw.text((80, 80), unicode_text, font=unicode_font, fill=font_color)
im.show()

and below is the reult:

enter image description here

So what am i doing wrong?

like image 547
beh-f Avatar asked Jul 27 '26 08:07

beh-f


1 Answers

Pillow 8.0.0 has now been released by adding support for COLR fonts.

Source: https://github.com/python-pillow/Pillow/pull/4955

like image 86
Mehdi Rahimi Avatar answered Jul 28 '26 21:07

Mehdi Rahimi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!