Taka005 commited on
Commit ·
1dea433
1
Parent(s): c72b3e5
追加
Browse files
main.py
CHANGED
|
@@ -153,9 +153,9 @@ def reverseMake(name, tag, id, content, icon):
|
|
| 153 |
tsize_name = drawText(img, (390, name_y), f"{name}#{tag}", size=25, color=(255, 255, 255, 255), split_len=25, disable_dot_wrap=True)
|
| 154 |
|
| 155 |
id_y = name_y + tsize_name[1] + 4
|
| 156 |
-
tsize_id = drawText(img, (390, id_y), id, size=18, color=(
|
| 157 |
|
| 158 |
-
tx.text((6, 694), BRAND, font=MPLUS_FONT, fill=(
|
| 159 |
|
| 160 |
file = io.BytesIO()
|
| 161 |
img.save(file, format="PNG", quality=95)
|
|
@@ -179,9 +179,35 @@ def whiteMake(name, tag, id, content, icon):
|
|
| 179 |
tsize_name = drawText(img, (890, name_y), f"{name}#{tag}", size=25, color=(0, 0, 0, 0), split_len=25, disable_dot_wrap=True)
|
| 180 |
|
| 181 |
id_y = name_y + tsize_name[1] + 4
|
| 182 |
-
tsize_id = drawText(img, (890, id_y), id, size=18, color=(
|
| 183 |
|
| 184 |
-
tx.text((1122, 694), BRAND, font=MPLUS_FONT, fill=(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
|
| 186 |
file = io.BytesIO()
|
| 187 |
img.save(file, format="PNG", quality=95)
|
|
@@ -234,6 +260,17 @@ def white():
|
|
| 234 |
)
|
| 235 |
return send_file(res, mimetype="image/png")
|
| 236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
|
| 238 |
if __name__ == "__main__":
|
| 239 |
app.run(host="0.0.0.0", port=3000)
|
|
|
|
| 153 |
tsize_name = drawText(img, (390, name_y), f"{name}#{tag}", size=25, color=(255, 255, 255, 255), split_len=25, disable_dot_wrap=True)
|
| 154 |
|
| 155 |
id_y = name_y + tsize_name[1] + 4
|
| 156 |
+
tsize_id = drawText(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)
|
|
|
|
| 179 |
tsize_name = drawText(img, (890, name_y), f"{name}#{tag}", size=25, color=(0, 0, 0, 0), split_len=25, disable_dot_wrap=True)
|
| 180 |
|
| 181 |
id_y = name_y + tsize_name[1] + 4
|
| 182 |
+
tsize_id = drawText(img, (890, id_y), id, size=18, color=(90, 90, 90, 255), split_len=45, disable_dot_wrap=True)
|
| 183 |
|
| 184 |
+
tx.text((1122, 694), BRAND, font=MPLUS_FONT, fill=(110, 110, 110, 215))
|
| 185 |
+
|
| 186 |
+
file = io.BytesIO()
|
| 187 |
+
img.save(file, format="PNG", quality=95)
|
| 188 |
+
file.seek(0)
|
| 189 |
+
return file
|
| 190 |
+
|
| 191 |
+
def reverseWhiteMake(name, tag, id, content, icon):
|
| 192 |
+
img = BASE_IMAGE.copy()
|
| 193 |
+
|
| 194 |
+
icon = Image.open(io.BytesIO(requests.get(icon).content))
|
| 195 |
+
icon = icon.resize((720, 720), Image.LANCZOS)
|
| 196 |
+
|
| 197 |
+
img.paste(icon, (570, 0), icon)
|
| 198 |
+
img.paste(BASE_RV_W_IMAGE, (0, 0), BASE_RV_W_IMAGE)
|
| 199 |
+
|
| 200 |
+
tx = ImageDraw.Draw(img)
|
| 201 |
+
|
| 202 |
+
tsize_t = drawText(img, (390, 270), content, size=45, color=(255, 255, 255, 255), split_len=16, auto_expand=True)
|
| 203 |
+
|
| 204 |
+
name_y = tsize_t[2] + 40
|
| 205 |
+
tsize_name = drawText(img, (390, name_y), f"{name}#{tag}", size=25, color=(255, 255, 255, 255), split_len=25, disable_dot_wrap=True)
|
| 206 |
+
|
| 207 |
+
id_y = name_y + tsize_name[1] + 4
|
| 208 |
+
tsize_id = drawText(img, (390, id_y), id, size=18, color=(90, 90, 90, 255), split_len=45, disable_dot_wrap=True)
|
| 209 |
+
|
| 210 |
+
tx.text((6, 694), BRAND, font=MPLUS_FONT, fill=(110, 110, 110, 255))
|
| 211 |
|
| 212 |
file = io.BytesIO()
|
| 213 |
img.save(file, format="PNG", quality=95)
|
|
|
|
| 260 |
)
|
| 261 |
return send_file(res, mimetype="image/png")
|
| 262 |
|
| 263 |
+
@app.route("/riverseWhite", methods=["GET"])
|
| 264 |
+
def white():
|
| 265 |
+
res = riverseWhiteMake(
|
| 266 |
+
request.args.get("name") or "SAMPLE",
|
| 267 |
+
request.args.get("tag") or "1234",
|
| 268 |
+
request.args.get("id") or "0000000000000000000",
|
| 269 |
+
request.args.get("content") or "Make it a Quote",
|
| 270 |
+
request.args.get("icon") or "https://cdn.discordapp.com/embed/avatars/0.png"
|
| 271 |
+
)
|
| 272 |
+
return send_file(res, mimetype="image/png")
|
| 273 |
+
|
| 274 |
|
| 275 |
if __name__ == "__main__":
|
| 276 |
app.run(host="0.0.0.0", port=3000)
|