Taka005 commited on
Commit
cd6bd2c
·
1 Parent(s): 996c3c4
Files changed (1) hide show
  1. main.py +4 -52
main.py CHANGED
@@ -116,52 +116,15 @@ def color_gen(name, tag, id, content, icon):
116
 
117
  tx = ImageDraw.Draw(img)
118
 
119
- tsize_t = draw_text(img, (890, 270), content, size=45, color=(
120
- 255, 255, 255, 255), split_len=16, auto_expand=True)
121
-
122
- name_y = tsize_t[2] + 40
123
- tsize_name = draw_text(img, (890, name_y), f"{name}#{tag}", size=25, color=(
124
- 255, 255, 255, 255), split_len=25, disable_dot_wrap=True)
125
-
126
- id_y = name_y + tsize_name[1] + 4
127
- tsize_id = draw_text(img, (890, id_y), id, size=18, color=(
128
- 180, 180, 180, 255), split_len=45, disable_dot_wrap=True)
129
-
130
- tx.text((1125, 694), branding,
131
- font=MPLUS_FONT, fill=(120, 120, 120, 255))
132
-
133
- file = io.BytesIO()
134
- img.save(file, format="PNG", quality=95)
135
- file.seek(0)
136
- return file
137
-
138
- # 反転
139
- def reverse_gen(name, tag, id, content, icon):
140
- img = BASE_IMAGE.copy()
141
-
142
- icon = Image.open(io.BytesIO(requests.get(icon).content))
143
- icon = icon.resize((720, 720), Image.LANCZOS)
144
- icon = icon.convert("L")
145
- icon_filtered = ImageEnhance.Brightness(icon)
146
-
147
- img.paste(icon_filtered.enhance(0.7), (570, 0))
148
- img.paste(BASE_FLIPPED_IMAGE, (0, 0), BASE_FLIPPED_IMAGE)
149
-
150
- tx = ImageDraw.Draw(img)
151
-
152
- tsize_t = draw_text(img, (390, 270), content, size=45, color=(
153
- 255, 255, 255, 255), split_len=16, auto_expand=True)
154
 
155
  name_y = tsize_t[2] + 40
156
- tsize_name = draw_text(img, (390, name_y), f"{name}#{tag}", size=25, color=(
157
- 255, 255, 255, 255), split_len=25, disable_dot_wrap=True)
158
 
159
  id_y = name_y + tsize_name[1] + 4
160
- tsize_id = draw_text(img, (390, id_y), id, size=18, color=(
161
- 180, 180, 180, 255), split_len=45, disable_dot_wrap=True)
162
 
163
- tx.text((15, 694), branding,
164
- font=MPLUS_FONT, fill=(120, 120, 120, 255))
165
 
166
  file = io.BytesIO()
167
  img.save(file, format="PNG", quality=95)
@@ -192,16 +155,5 @@ def color():
192
  )
193
  return send_file(res, mimetype="image/png")
194
 
195
- @app.route("/reverse", methods=["GET"])
196
- def reverse():
197
- res = reverse_gen(
198
- request.args.get("name") or "名無し",
199
- request.args.get("tag") or "0000",
200
- request.args.get("id") or "0000000000000000000",
201
- request.args.get("content") or "これはテストです",
202
- request.args.get("icon") or "https://cdn.discordapp.com/embed/avatars/0.png"
203
- )
204
- return send_file(res, mimetype="image/png")
205
-
206
  if __name__ == "__main__":
207
  app.run(host="0.0.0.0", port=3000)
 
116
 
117
  tx = ImageDraw.Draw(img)
118
 
119
+ tsize_t = draw_text(img, (890, 270), content, size=45, color=(255, 255, 255, 255), split_len=16, auto_expand=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
 
121
  name_y = tsize_t[2] + 40
122
+ tsize_name = draw_text(img, (890, name_y), f"{name}#{tag}", size=25, color=(255, 255, 255, 255), split_len=25, disable_dot_wrap=True)
 
123
 
124
  id_y = name_y + tsize_name[1] + 4
125
+ tsize_id = draw_text(img, (890, id_y), id, size=18, color=(180, 180, 180, 255), split_len=45, disable_dot_wrap=True)
 
126
 
127
+ tx.text((1125, 694), "TakasumBOT#7189",font=MPLUS_FONT, fill=(120, 120, 120, 255))
 
128
 
129
  file = io.BytesIO()
130
  img.save(file, format="PNG", quality=95)
 
155
  )
156
  return send_file(res, mimetype="image/png")
157
 
 
 
 
 
 
 
 
 
 
 
 
158
  if __name__ == "__main__":
159
  app.run(host="0.0.0.0", port=3000)