emoji icon indicating copy to clipboard operation
emoji copied to clipboard

render emoji in Pillow

Open guitar9 opened this issue 6 years ago • 6 comments

is it possible to render Text with emoji in an Image with Pillow?

guitar9 avatar Sep 11 '18 20:09 guitar9

Perhaps this may help? https://github.com/python-pillow/Pillow/issues/1774

giff-h avatar Sep 11 '18 23:09 giff-h

thanks but i want colored emoji. Like if you writing in whatsapp or facebook.

guitar9 avatar Sep 12 '18 07:09 guitar9

where you able to find a solution?

alexislg2 avatar Jan 24 '19 11:01 alexislg2

No

Am Do., 24. Jan. 2019, 12:21 hat ALEXIS LE GOFF [email protected] geschrieben:

where you able to find a solution?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/carpedm20/emoji/issues/85#issuecomment-457162606, or mute the thread https://github.com/notifications/unsubscribe-auth/AYh5FMbu2GRfgHZhdgzYOckc_IeQZ4NJks5vGZdKgaJpZM4WkLjV .

guitar9 avatar Jan 26 '19 19:01 guitar9

is it possible to render Text with emoji in an Image with Pillow?

I've created auepa for it, but emojicdn's much faster

from os import *
from emoji import *
from PIL import Image
from requests import get
del open
chdir(path.expanduser("~/Desktop"))

#---#

Emoji = ":snake:"
Style = "twitter"	# http://github.com/benborgers/emojicdn#emoji-style

#---# 

im = Image.open(
    get(
        "https://emojicdn.elk.sh/{0}?style={1}".format(
            emojize(Emoji.lower(), use_aliases = 1),
            ("?style=" + Style.lower()) if Style else ""
        ),
        stream = 1).raw
    )
)
im = im.crop(im.getbbox())
im.save(demojize(Emoji[1:-1]) + ".png")
im.show()

kubinka0505 avatar Oct 06 '21 14:10 kubinka0505

There is a library for doing this that supports different emoji styles: https://github.com/jay3332/pilmoji -- https://pypi.org/project/pilmoji/

cvzi avatar Feb 01 '23 10:02 cvzi