Skip to content

Commit

Permalink
Don't use transparency mask for Wrapped images (#575)
Browse files Browse the repository at this point in the history
* hmm, just add the mask ourselves?

* punting, just don't use a mask for the images
  • Loading branch information
zmattingly authored Jan 5, 2025
1 parent c6be0a1 commit cb116e5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
4 changes: 2 additions & 2 deletions charts/agimus/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: agimus
description: A helm chart for a discord bot that also runs a mysql db
type: application
version: v2.12.7
appVersion: v2.12.7
version: v2.12.8
appVersion: v2.12.8
21 changes: 8 additions & 13 deletions tasks/wrapped_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async def wrapped_generation():
if not enabled:
return

job = await db_get_top_wrapped_job()m
job = await db_get_top_wrapped_job()
if job:
user = await bot.current_guild.fetch_member(int(job['user_discord_id']))
maintainer_user = await bot.current_guild.fetch_member(int(config["tasks"]["wrapped_generation"]["maintainer_user_id"]))
Expand Down Expand Up @@ -118,10 +118,11 @@ def _generate_wrapped_mp4(user_discord_id, user_display_name, wrapped_data):
avatar_path = f"./images/profiles/{user_discord_id}_a_256.png"
if not os.path.exists(avatar_path):
raise FileNotFoundError(avatar_path)

profile_image = ImageClip(avatar_path)
profile_image = profile_image.with_effects([Resize(width=400), FadeIn(duration=0.4167)])
profile_image = profile_image.with_duration(4.375).with_start(5.1667).with_position(("center", 350))
profile_image = profile_image.with_mask(profile_image.mask.with_effects([FadeOut(duration=0.8333)]))
profile_image = profile_image.with_effects([FadeOut(duration=0.8333)])

# Channels
first_channel_y = 450
Expand Down Expand Up @@ -311,14 +312,12 @@ def _generate_wrapped_mp4(user_discord_id, user_display_name, wrapped_data):
raise FileNotFoundError(f"Rarest Badge file not found at {rarest_badge_filepath}")

rarest_badge_image = ImageClip(rarest_badge_filepath)
rarest_badge_image = ImageClip(rarest_badge_filepath)

if rarest_badge_image:
rarest_badge_image = rarest_badge_image.with_effects([Resize(width=500)])
rarest_badge_image = rarest_badge_image.with_duration(3.25).with_start(54.375).with_position(("center", "center"))
rarest_badge_image = rarest_badge_image.with_mask(
rarest_badge_image.mask.with_effects([
FadeOut(duration=0.625)
])
)
rarest_badge_image = rarest_badge_image.with_effects([FadeOut(duration=0.625)])

rarest_badge_name = TextClip(text=f"{wrapped_data['rarest_badge']['badge_name']}", font_size=50, color="white", stroke_color="black", stroke_width=2, font="fonts/DS9_Credits.ttf", margin=(20, 20))
rarest_badge_name = rarest_badge_name.with_duration(3.25).with_start(54.375).with_position(("center", 200))
Expand Down Expand Up @@ -348,14 +347,10 @@ def _generate_wrapped_mp4(user_discord_id, user_display_name, wrapped_data):
scale_factor = video_width / rarest_badge_owner_rarity_size
rarest_badge_owner_rarity = rarest_badge_owner_rarity.with_effects([Resize(scale_factor)])
else:
rarest_badge_image = ImageClip("./images/badges/Friends_Of_DeSoto.png")
rarest_badge_image = ImageClip("./images/badges/Friends_Of_DeSoto.png", transparent=False)
rarest_badge_image = rarest_badge_image.with_effects([Resize(width=500)])
rarest_badge_image = rarest_badge_image.with_duration(3.25).with_start(54.375).with_position(("center", "center"))
rarest_badge_image = rarest_badge_image.with_mask(
rarest_badge_image.mask.with_effects([
FadeOut(duration=0.625)
])
)
rarest_badge_image = rarest_badge_image.with_effects([FadeOut(duration=0.625)])

rarest_badge_name = TextClip(text="Whoops, you didn't collect a rare badge this year!", font_size=50, color="white", stroke_color="black", stroke_width=2, font="fonts/DS9_Credits.ttf", margin=(20, 20))
rarest_badge_name = rarest_badge_name.with_duration(3.25).with_start(54.375).with_position(("center", 200))
Expand Down

0 comments on commit cb116e5

Please sign in to comment.