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

Main branch update from Dev branch #28

Merged
merged 3 commits into from
Sep 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,19 @@ async def eventInviteHandler(inviterId: str):
raise ValueError("eventInviteHandler : Invalid profileImageUrl")
img_profile = Image.open(BytesIO(res_profile.content))

# convert rgb(a) to bgr(a) format (cv2 uses bgr format)
img_profile_array = np.array(img_profile)
img_profile_array[..., :3] = img_profile_array[..., :3][..., ::-1]
img_profile = Image.fromarray(img_profile_array)

# convert inviter information to text
text = {
"nickname": inviterInfo["nickname"],
"message": "님이 이벤트에 초대했습니다."
}

# load background image
img_og = Image.fromarray(images["background.{}.eventInvite".format(event_type)])
img_og = Image.fromarray(images["background.{}.eventInvite".format(event_type)]).convert("RGBA")
draw = ImageDraw.Draw(img_og, "RGBA")

# draw nickname
Expand All @@ -214,6 +219,8 @@ async def eventInviteHandler(inviterId: str):
draw.text((31, 140), text["message"], font=fonts["eventInvite"]["message"], fill=colors["white"])

# draw profile image
if min(img_profile.size) > 245:
img_profile = img_profile.crop((0, 0, min(img_profile.size), min(img_profile.size)))
img_profile = img_profile.resize((245, 245))

scale_factor = 4 # for anti-aliasing
Expand Down
Loading