Skip to content

Commit

Permalink
Merge pull request #28 from sparcs-kaist/dev
Browse files Browse the repository at this point in the history
Main branch update from Dev branch
  • Loading branch information
kmc7468 authored Sep 7, 2024
2 parents c5c6636 + f1e13db commit 6a8d933
Showing 1 changed file with 8 additions and 1 deletion.
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

0 comments on commit 6a8d933

Please sign in to comment.