我正在尝试使用枕头库将表情符号插入图像中,但结果不是我想要的。
我希望表情符号看起来与在 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()
结果如下:那我做错了什么?
最佳答案
似乎这尚未在枕头中实现,如下所示:
https://github.com/python-pillow/Pillow/issues/3346
和这里 :
https://github.com/python-pillow/Pillow/pull/4955
也许您需要尝试如下所述的解决方法:
How to render emojis as images in Python under Windows?
关于python - 将彩色表情符号插入图像(Python),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64253461/