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

image not recognized... #2

Open
barshag opened this issue Jan 28, 2023 · 2 comments
Open

image not recognized... #2

barshag opened this issue Jan 28, 2023 · 2 comments

Comments

@barshag
Copy link

barshag commented Jan 28, 2023

sometimes it return unrecognize iamge... not stable..

@chuhaojin
Copy link
Owner

chuhaojin commented Jan 29, 2023

Thank you for using our text2poster. I have checked the logs and it appears that the failure may be due to some text boxes having widths that exceeded the image width (either due to the sentence being too long or the font size being too large). I have now added a 500 status code in the api's response to specifically indicate the reason for poster generation failure:

if response.status_code == 200:
    f = open("poster-{}.jpg".format(timestamp), "wb")
    f.write(response.content)
    f.close()
    print("Save poster to:", "poster-{}.jpg".format(timestamp))
else:
    print(response.text)

The error may look like:
{"error_code":1001,"error_info":"The text box width exceeds the image width. Please reduce the font size or text length."}

@barshag
Copy link
Author

barshag commented Jan 29, 2023

Thanks!
but that is just walk-around. Can you add limitation that check what is the maximum size beforehand?

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