Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -48,7 +48,7 @@ def generate_profile():
|
|
48 |
# Profile picture settings
|
49 |
pfp_size = 170
|
50 |
pfp_x = 50
|
51 |
-
pfp_y =
|
52 |
|
53 |
# Validate and load profile picture
|
54 |
pfp_path = PFP_OPTIONS.get(pfp_choice, "pfp1.png")
|
@@ -78,9 +78,8 @@ def generate_profile():
|
|
78 |
bg.paste(border, (pfp_x - border_size // 2, pfp_y - border_size // 2), border_mask)
|
79 |
|
80 |
# **TEXT POSITIONING**
|
81 |
-
|
82 |
-
|
83 |
-
text_spacing = 55 # Space between text lines
|
84 |
text_color = (255, 255, 255)
|
85 |
|
86 |
# Function to resize text dynamically
|
@@ -91,14 +90,20 @@ def generate_profile():
|
|
91 |
return font
|
92 |
|
93 |
# Adjust name font size dynamically
|
94 |
-
max_text_width = W -
|
95 |
name_font = fit_text(name, max_text_width, font_large)
|
96 |
|
97 |
-
# **Draw
|
98 |
-
draw.text((
|
99 |
-
|
100 |
-
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
|
103 |
# Save final image
|
104 |
output_path = os.path.join(TEMP_DIR, f"profile_{uuid.uuid4().hex}.png")
|
|
|
48 |
# Profile picture settings
|
49 |
pfp_size = 170
|
50 |
pfp_x = 50
|
51 |
+
pfp_y = 80 # Adjusted to align better
|
52 |
|
53 |
# Validate and load profile picture
|
54 |
pfp_path = PFP_OPTIONS.get(pfp_choice, "pfp1.png")
|
|
|
78 |
bg.paste(border, (pfp_x - border_size // 2, pfp_y - border_size // 2), border_mask)
|
79 |
|
80 |
# **TEXT POSITIONING**
|
81 |
+
name_x = pfp_x + pfp_size + 40 # Name beside profile picture
|
82 |
+
name_y = pfp_y + (pfp_size // 3) # Align vertically with profile picture
|
|
|
83 |
text_color = (255, 255, 255)
|
84 |
|
85 |
# Function to resize text dynamically
|
|
|
90 |
return font
|
91 |
|
92 |
# Adjust name font size dynamically
|
93 |
+
max_text_width = W - name_x - 50
|
94 |
name_font = fit_text(name, max_text_width, font_large)
|
95 |
|
96 |
+
# **Draw name beside profile picture**
|
97 |
+
draw.text((name_x, name_y), name, font=name_font, fill=text_color)
|
98 |
+
|
99 |
+
# **Other details BELOW profile picture**
|
100 |
+
info_x = pfp_x
|
101 |
+
info_y = pfp_y + pfp_size + 20 # Below the profile picture
|
102 |
+
text_spacing = 45 # Space between text lines
|
103 |
+
|
104 |
+
draw.text((info_x, info_y), f"Rank: {rank}", font=font_medium, fill=text_color)
|
105 |
+
draw.text((info_x, info_y + text_spacing), f"Balance: {balance}", font=font_medium, fill=text_color)
|
106 |
+
draw.text((info_x, info_y + 2 * text_spacing), f"Next Rank: {next_rank}", font=font_small, fill=text_color)
|
107 |
|
108 |
# Save final image
|
109 |
output_path = os.path.join(TEMP_DIR, f"profile_{uuid.uuid4().hex}.png")
|