Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pilmoji not working with any emojis source #38

Open
mateusbatista4 opened this issue Apr 18, 2024 · 3 comments
Open

Pilmoji not working with any emojis source #38

mateusbatista4 opened this issue Apr 18, 2024 · 3 comments

Comments

@mateusbatista4
Copy link

I've encountered an issue where Pilmoji doesn't seem to be working properly with all emoji sources. I've tried using various emoji sources, but the functionality is still not working.

Code Snippet:

response = requests.get(template_path)
img = Image.open(BytesIO(response.content))

width, height = img.size
draw = ImageDraw.Draw(img)
textsize = 34
string = textwrap.wrap(string, width=40)

font = ImageFont.truetype("./resources/upload_image/assets/fonts/Comfortaa-Regular.ttf", textsize)

string_prefix = ["[{}]".format(id), ""]
end_string = string_prefix + string
h = (height - len(end_string)*(textsize+16))/2
for line in end_string:
    a,b = draw.textsize(line, font=font)
    try:
        with Pilmoji(img) as pilmoji:
            pilmoji.text((int((width-a)/2),int(h)), line, (0,0,0), font, align='center', emoji_scale_factor=1, emoji_position_offset=(0, 2))
    except Exception as e:
        # Add error handling
        raise ConnectionError(e, request=request)
    h += textsize + 16
    img.save('./resources/upload_image/assets/img/out/sample-out.jpg')
return True

Error Message:
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='emojicdn.elk.sh', port=443): Max retries exceeded with url: /%E2%9D%A4%EF%B8%8F?style=twitter (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001FD97850520>: Failed to establish a new connection: [WinError 10060]

Additional Information:
Python Version: 3.8
Operating System: Win11
Pilmoji Version: 2.0.4

@mateusbatista4
Copy link
Author

Someone??

@jay3332
Copy link
Owner

jay3332 commented May 6, 2024

Seems like an issue with emojicdn, maybe a custom source could fix this

@mateusbatista4
Copy link
Author

What sources? I tried several, like Apple, Microsoft and Discord

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants