Taka005 commited on
Commit ·
b5ea086
1
Parent(s): e0b07cc
修正
Browse files
main.py
CHANGED
|
@@ -4,9 +4,7 @@ from flask import Flask, request, send_file
|
|
| 4 |
import textwrap
|
| 5 |
import requests
|
| 6 |
import warnings
|
| 7 |
-
import base64
|
| 8 |
import io
|
| 9 |
-
import os
|
| 10 |
|
| 11 |
warnings.simplefilter("ignore")
|
| 12 |
|
|
@@ -21,7 +19,7 @@ MPLUS_FONT = ImageFont.truetype("fonts/MPLUSRounded1c-Regular.ttf", size=16)
|
|
| 21 |
BRAND = "TakasumiBOT#7189"
|
| 22 |
|
| 23 |
def drawText(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 |
-
|
| 25 |
fontObj = ImageFont.truetype(font, size=size)
|
| 26 |
|
| 27 |
pure_lines = []
|
|
@@ -99,7 +97,7 @@ def make(name, id, content, icon):
|
|
| 99 |
tsize_name = drawText(img, (890, name_y), f"@{name}", size=25, color=(255, 255, 255, 255), split_len=25, disable_dot_wrap=True)
|
| 100 |
|
| 101 |
id_y = name_y + tsize_name[1] + 4
|
| 102 |
-
|
| 103 |
|
| 104 |
tx.text((1122, 694), BRAND, font=MPLUS_FONT, fill=(120, 120, 120, 255))
|
| 105 |
|
|
@@ -125,7 +123,7 @@ def colorMake(name, id, content, icon):
|
|
| 125 |
tsize_name = drawText(img, (890, name_y), f"@{name}", size=25, color=(255, 255, 255, 255), split_len=25, disable_dot_wrap=True)
|
| 126 |
|
| 127 |
id_y = name_y + tsize_name[1] + 4
|
| 128 |
-
|
| 129 |
|
| 130 |
tx.text((1122, 694), BRAND,font=MPLUS_FONT, fill=(120, 120, 120, 255))
|
| 131 |
|
|
@@ -153,7 +151,7 @@ def reverseMake(name, id, content, icon):
|
|
| 153 |
tsize_name = drawText(img, (390, name_y), f"@{name}", 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 |
-
|
| 157 |
|
| 158 |
tx.text((6, 694), BRAND, font=MPLUS_FONT, fill=(120, 120, 120, 255))
|
| 159 |
|
|
@@ -179,7 +177,7 @@ def reverseColorMake(name, id, content, icon):
|
|
| 179 |
tsize_name = drawText(img, (390, name_y), f"@{name}", size=25, color=(255, 255, 255, 255), split_len=25, disable_dot_wrap=True)
|
| 180 |
|
| 181 |
id_y = name_y + tsize_name[1] + 4
|
| 182 |
-
|
| 183 |
|
| 184 |
tx.text((6, 694), BRAND, font=MPLUS_FONT, fill=(120, 120, 120, 255))
|
| 185 |
|
|
@@ -205,7 +203,7 @@ def whiteMake(name, id, content, icon):
|
|
| 205 |
tsize_name = drawText(img, (890, name_y), f"@{name}", size=25, color=(0, 0, 0, 0), split_len=25, disable_dot_wrap=True)
|
| 206 |
|
| 207 |
id_y = name_y + tsize_name[1] + 4
|
| 208 |
-
|
| 209 |
|
| 210 |
tx.text((1122, 694), BRAND, font=MPLUS_FONT, fill=(110, 110, 110, 215))
|
| 211 |
|
|
@@ -231,7 +229,7 @@ def reverseWhiteMake(name, id, content, icon):
|
|
| 231 |
tsize_name = drawText(img, (390, name_y), f"@{name}", size=25, color=(0, 0, 0, 0), split_len=25, disable_dot_wrap=True)
|
| 232 |
|
| 233 |
id_y = name_y + tsize_name[1] + 4
|
| 234 |
-
|
| 235 |
|
| 236 |
tx.text((6, 694), BRAND, font=MPLUS_FONT, fill=(110, 110, 110, 255))
|
| 237 |
|
|
|
|
| 4 |
import textwrap
|
| 5 |
import requests
|
| 6 |
import warnings
|
|
|
|
| 7 |
import io
|
|
|
|
| 8 |
|
| 9 |
warnings.simplefilter("ignore")
|
| 10 |
|
|
|
|
| 19 |
BRAND = "TakasumiBOT#7189"
|
| 20 |
|
| 21 |
def drawText(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):
|
| 22 |
+
ImageDraw.Draw(im)
|
| 23 |
fontObj = ImageFont.truetype(font, size=size)
|
| 24 |
|
| 25 |
pure_lines = []
|
|
|
|
| 97 |
tsize_name = drawText(img, (890, name_y), f"@{name}", size=25, color=(255, 255, 255, 255), split_len=25, disable_dot_wrap=True)
|
| 98 |
|
| 99 |
id_y = name_y + tsize_name[1] + 4
|
| 100 |
+
drawText(img, (890, id_y), id, size=18, color=(180, 180, 180, 255), split_len=45, disable_dot_wrap=True)
|
| 101 |
|
| 102 |
tx.text((1122, 694), BRAND, font=MPLUS_FONT, fill=(120, 120, 120, 255))
|
| 103 |
|
|
|
|
| 123 |
tsize_name = drawText(img, (890, name_y), f"@{name}", size=25, color=(255, 255, 255, 255), split_len=25, disable_dot_wrap=True)
|
| 124 |
|
| 125 |
id_y = name_y + tsize_name[1] + 4
|
| 126 |
+
drawText(img, (890, id_y), id, size=18, color=(180, 180, 180, 255), split_len=45, disable_dot_wrap=True)
|
| 127 |
|
| 128 |
tx.text((1122, 694), BRAND,font=MPLUS_FONT, fill=(120, 120, 120, 255))
|
| 129 |
|
|
|
|
| 151 |
tsize_name = drawText(img, (390, name_y), f"@{name}", size=25, color=(255, 255, 255, 255), split_len=25, disable_dot_wrap=True)
|
| 152 |
|
| 153 |
id_y = name_y + tsize_name[1] + 4
|
| 154 |
+
drawText(img, (390, id_y), id, size=18, color=(180, 180, 180, 255), split_len=45, disable_dot_wrap=True)
|
| 155 |
|
| 156 |
tx.text((6, 694), BRAND, font=MPLUS_FONT, fill=(120, 120, 120, 255))
|
| 157 |
|
|
|
|
| 177 |
tsize_name = drawText(img, (390, name_y), f"@{name}", size=25, color=(255, 255, 255, 255), split_len=25, disable_dot_wrap=True)
|
| 178 |
|
| 179 |
id_y = name_y + tsize_name[1] + 4
|
| 180 |
+
drawText(img, (390, id_y), id, size=18, color=(180, 180, 180, 255), split_len=45, disable_dot_wrap=True)
|
| 181 |
|
| 182 |
tx.text((6, 694), BRAND, font=MPLUS_FONT, fill=(120, 120, 120, 255))
|
| 183 |
|
|
|
|
| 203 |
tsize_name = drawText(img, (890, name_y), f"@{name}", size=25, color=(0, 0, 0, 0), split_len=25, disable_dot_wrap=True)
|
| 204 |
|
| 205 |
id_y = name_y + tsize_name[1] + 4
|
| 206 |
+
drawText(img, (890, id_y), id, size=18, color=(90, 90, 90, 255), split_len=45, disable_dot_wrap=True)
|
| 207 |
|
| 208 |
tx.text((1122, 694), BRAND, font=MPLUS_FONT, fill=(110, 110, 110, 215))
|
| 209 |
|
|
|
|
| 229 |
tsize_name = drawText(img, (390, name_y), f"@{name}", size=25, color=(0, 0, 0, 0), split_len=25, disable_dot_wrap=True)
|
| 230 |
|
| 231 |
id_y = name_y + tsize_name[1] + 4
|
| 232 |
+
drawText(img, (390, id_y), id, size=18, color=(90, 90, 90, 255), split_len=45, disable_dot_wrap=True)
|
| 233 |
|
| 234 |
tx.text((6, 694), BRAND, font=MPLUS_FONT, fill=(110, 110, 110, 255))
|
| 235 |
|