Taka005 commited on
Commit
7d3f45e
·
1 Parent(s): 4cb196e
Files changed (5) hide show
  1. a.png +0 -0
  2. images/base-gd-w-rv.png +0 -0
  3. images/base-gd-w.png +0 -0
  4. main.py +48 -4
  5. test.png +0 -0
a.png ADDED
images/base-gd-w-rv.png ADDED
images/base-gd-w.png ADDED
main.py CHANGED
@@ -12,9 +12,13 @@ warnings.simplefilter("ignore")
12
 
13
  BASE_GD_IMAGE = Image.open("images/base-gd.png")
14
  BASE_RV_IMAGE = Image.open("images/base-gd-rv.png")
 
 
 
 
15
  BASE_IMAGE = Image.open("images/base.png")
16
  MPLUS_FONT = ImageFont.truetype("fonts/MPLUSRounded1c-Regular.ttf", size=16)
17
- branding = "TakasumiBOT#7189"
18
 
19
  def draw_text(im, ofs, string, font="fonts/MPLUSRounded1c-Regular.ttf", size=16, color=(0, 0, 0, 255), split_len=None, padding=4, auto_expand=False, disable_dot_wrap=False):
20
  draw = ImageDraw.Draw(im)
@@ -97,7 +101,7 @@ def make(name, tag, id, content, icon):
97
  id_y = name_y + tsize_name[1] + 4
98
  tsize_id = draw_text(img, (890, id_y), id, size=18, color=(180, 180, 180, 255), split_len=45, disable_dot_wrap=True)
99
 
100
- tx.text((1122, 694), branding, font=MPLUS_FONT, fill=(120, 120, 120, 255))
101
 
102
  file = io.BytesIO()
103
  img.save(file, format="PNG", quality=95)
@@ -123,7 +127,7 @@ def colormake(name, tag, id, content, icon):
123
  id_y = name_y + tsize_name[1] + 4
124
  tsize_id = draw_text(img, (890, id_y), id, size=18, color=(180, 180, 180, 255), split_len=45, disable_dot_wrap=True)
125
 
126
- tx.text((1122, 694), branding,font=MPLUS_FONT, fill=(120, 120, 120, 255))
127
 
128
  file = io.BytesIO()
129
  img.save(file, format="PNG", quality=95)
@@ -151,7 +155,35 @@ def reversemake(name, tag, id, content, icon):
151
  id_y = name_y + tsize_name[1] + 4
152
  tsize_id = draw_text(img, (390, id_y), id, size=18, color=(180, 180, 180, 255), split_len=45, disable_dot_wrap=True)
153
 
154
- tx.text((6, 694), branding,font=MPLUS_FONT, fill=(120, 120, 120, 255))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
 
156
  file = io.BytesIO()
157
  img.save(file, format="PNG", quality=95)
@@ -193,5 +225,17 @@ def reverse():
193
  )
194
  return send_file(res, mimetype="image/png")
195
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  if __name__ == "__main__":
197
  app.run(host="0.0.0.0", port=3000)
 
12
 
13
  BASE_GD_IMAGE = Image.open("images/base-gd.png")
14
  BASE_RV_IMAGE = Image.open("images/base-gd-rv.png")
15
+
16
+ BASE_GD_W_IMAGE = Image.open("images/base-gd-w.png")
17
+ BASE_RV_W_IMAGE = Image.open("images/base-gd-w-rv.png")
18
+
19
  BASE_IMAGE = Image.open("images/base.png")
20
  MPLUS_FONT = ImageFont.truetype("fonts/MPLUSRounded1c-Regular.ttf", size=16)
21
+ BRAND = "TakasumiBOT#7189"
22
 
23
  def draw_text(im, ofs, string, font="fonts/MPLUSRounded1c-Regular.ttf", size=16, color=(0, 0, 0, 255), split_len=None, padding=4, auto_expand=False, disable_dot_wrap=False):
24
  draw = ImageDraw.Draw(im)
 
101
  id_y = name_y + tsize_name[1] + 4
102
  tsize_id = draw_text(img, (890, id_y), id, size=18, color=(180, 180, 180, 255), split_len=45, disable_dot_wrap=True)
103
 
104
+ tx.text((1122, 694), BRAND, font=MPLUS_FONT, fill=(120, 120, 120, 255))
105
 
106
  file = io.BytesIO()
107
  img.save(file, format="PNG", quality=95)
 
127
  id_y = name_y + tsize_name[1] + 4
128
  tsize_id = draw_text(img, (890, id_y), id, size=18, color=(180, 180, 180, 255), split_len=45, disable_dot_wrap=True)
129
 
130
+ tx.text((1122, 694), BRAND,font=MPLUS_FONT, fill=(120, 120, 120, 255))
131
 
132
  file = io.BytesIO()
133
  img.save(file, format="PNG", quality=95)
 
155
  id_y = name_y + tsize_name[1] + 4
156
  tsize_id = draw_text(img, (390, id_y), id, size=18, color=(180, 180, 180, 255), split_len=45, disable_dot_wrap=True)
157
 
158
+ tx.text((6, 694), BRAND,font=MPLUS_FONT, fill=(120, 120, 120, 255))
159
+
160
+ file = io.BytesIO()
161
+ img.save(file, format="PNG", quality=95)
162
+ file.seek(0)
163
+ return file
164
+
165
+ def whitemake(name, tag, id, content, icon):
166
+ img = BASE_IMAGE.copy()
167
+
168
+ icon = Image.open(io.BytesIO(requests.get(icon).content))
169
+ icon = icon.resize((720, 720), Image.LANCZOS)
170
+ icon = icon.convert("L")
171
+ icon_filtered = ImageEnhance.Brightness(icon)
172
+
173
+ img.paste(icon_filtered.enhance(0.7), (0, 0))
174
+ img.paste(BASE_GD_W_IMAGE, (0, 0), BASE_GD_W_IMAGE)
175
+
176
+ tx = ImageDraw.Draw(img)
177
+
178
+ tsize_t = draw_text(img, (890, 270), content, size=45, color=(0, 0, 0, 0), split_len=16, auto_expand=True)
179
+
180
+ name_y = tsize_t[2] + 40
181
+ tsize_name = draw_text(img, (890, name_y), f"{name}#{tag}", size=25, color=(0, 0, 0, 0), split_len=25, disable_dot_wrap=True)
182
+
183
+ id_y = name_y + tsize_name[1] + 4
184
+ tsize_id = draw_text(img, (890, id_y), id, size=18, color=(180, 180, 180, 255), split_len=45, disable_dot_wrap=True)
185
+
186
+ tx.text((1122, 694), BRAND, font=MPLUS_FONT, fill=(120, 120, 120, 255))
187
 
188
  file = io.BytesIO()
189
  img.save(file, format="PNG", quality=95)
 
225
  )
226
  return send_file(res, mimetype="image/png")
227
 
228
+ @app.route("/white", methods=["GET"])
229
+ def white():
230
+ res = whitemake(
231
+ request.args.get("name") or "SAMPLE",
232
+ request.args.get("tag") or "1234",
233
+ request.args.get("id") or "0000000000000000000",
234
+ request.args.get("content") or "Make it a Quote",
235
+ request.args.get("icon") or "https://cdn.discordapp.com/embed/avatars/0.png"
236
+ )
237
+ return send_file(res, mimetype="image/png")
238
+
239
+
240
  if __name__ == "__main__":
241
  app.run(host="0.0.0.0", port=3000)
test.png ADDED