将彩色表情符号插入图像(Python)

beh*_*h-f 5 python python-imaging-library

我正在尝试使用枕头库将表情符号插入图像中,但结果不是我想要的。

我希望表情符号看起来和 iPhone 中的一模一样,但结果是一个黑白丑陋的表情符号。

这是我的代码:

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()
Run Code Online (Sandbox Code Playgroud)

下面是结果:

在此输入图像描述

那么我做错了什么?

小智 3

看来这还没有在枕头中实现,如下所示: https: //github.com/python-pillow/Pillow/issues/3346 和这里: https: //github.com/python-pillow/Pillow/拉/4955

也许您需要尝试一种解决方法,如下所述: How to render emojis as images in Python under Windows?