Taka005
commited on
Commit
·
ab969e9
1
Parent(s):
fc2ade5
修正
Browse files
README.md
CHANGED
|
@@ -7,6 +7,7 @@
|
|
| 7 |
- `/` Make it a Quote画像
|
| 8 |
- `/colour` カラーアイコン
|
| 9 |
- `/reverse` アイコンの位置反転
|
|
|
|
| 10 |
- `/white` 色反転
|
| 11 |
- `/reverseWhite` 色反転・アイコンの位置反転
|
| 12 |
## パラメーター
|
|
|
|
| 7 |
- `/` Make it a Quote画像
|
| 8 |
- `/colour` カラーアイコン
|
| 9 |
- `/reverse` アイコンの位置反転
|
| 10 |
+
- `/reverseColor` カラーアイコン・アイコンの位置反転
|
| 11 |
- `/white` 色反転
|
| 12 |
- `/reverseWhite` 色反転・アイコンの位置反転
|
| 13 |
## パラメーター
|
main.py
CHANGED
|
@@ -162,12 +162,38 @@ def reverseMake(name, id, content, icon):
|
|
| 162 |
file.seek(0)
|
| 163 |
return file
|
| 164 |
|
| 165 |
-
def
|
| 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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
img.paste(icon, (0, 0), icon)
|
| 172 |
img.paste(BASE_GD_W_IMAGE, (0, 0), BASE_GD_W_IMAGE)
|
| 173 |
|
|
@@ -191,7 +217,7 @@ def whiteMake(name, id, content, icon):
|
|
| 191 |
def reverseWhiteMake(name, 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)
|
|
@@ -246,6 +272,17 @@ def reverse():
|
|
| 246 |
)
|
| 247 |
return send_file(res, mimetype="image/png")
|
| 248 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 249 |
@app.route("/white", methods=["GET"])
|
| 250 |
def white():
|
| 251 |
res = whiteMake(
|
|
|
|
| 162 |
file.seek(0)
|
| 163 |
return file
|
| 164 |
|
| 165 |
+
def reverseColorMake(name, 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 |
|
| 171 |
+
img.paste(icon, (570, 0))
|
| 172 |
+
img.paste(BASE_RV_IMAGE, (0, 0), BASE_RV_IMAGE)
|
| 173 |
+
|
| 174 |
+
tx = ImageDraw.Draw(img)
|
| 175 |
+
|
| 176 |
+
tsize_t = drawText(img, (390, 270), content, size=45, color=(255, 255, 255, 255), split_len=16, auto_expand=True)
|
| 177 |
+
|
| 178 |
+
name_y = tsize_t[2] + 40
|
| 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 |
+
tsize_id = drawText(img, (390, id_y), id, size=18, color=(180, 180, 180, 255), split_len=45, disable_dot_wrap=True)
|
| 183 |
+
|
| 184 |
+
tx.text((6, 694), BRAND, font=MPLUS_FONT, fill=(120, 120, 120, 255))
|
| 185 |
+
|
| 186 |
+
file = io.BytesIO()
|
| 187 |
+
img.save(file, format="PNG", quality=95)
|
| 188 |
+
file.seek(0)
|
| 189 |
+
return file
|
| 190 |
+
|
| 191 |
+
def whiteMake(name, id, content, icon):
|
| 192 |
+
img = BASE_IMAGE.copy()
|
| 193 |
+
|
| 194 |
+
icon = Image.open(io.BytesIO(requests.get(icon).content)).convert("RGBA")
|
| 195 |
+
icon = icon.resize((720, 720), Image.LANCZOS)
|
| 196 |
+
|
| 197 |
img.paste(icon, (0, 0), icon)
|
| 198 |
img.paste(BASE_GD_W_IMAGE, (0, 0), BASE_GD_W_IMAGE)
|
| 199 |
|
|
|
|
| 217 |
def reverseWhiteMake(name, id, content, icon):
|
| 218 |
img = BASE_IMAGE.copy()
|
| 219 |
|
| 220 |
+
icon = Image.open(io.BytesIO(requests.get(icon).content)).convert("RGBA")
|
| 221 |
icon = icon.resize((720, 720), Image.LANCZOS)
|
| 222 |
|
| 223 |
img.paste(icon, (570, 0), icon)
|
|
|
|
| 272 |
)
|
| 273 |
return send_file(res, mimetype="image/png")
|
| 274 |
|
| 275 |
+
@app.route("/reverseColor", methods=["GET"])
|
| 276 |
+
def reverseColor():
|
| 277 |
+
res = reverseColorMake(
|
| 278 |
+
request.args.get("name") or "SAMPLE",
|
| 279 |
+
request.args.get("id") or "0000000000000000000",
|
| 280 |
+
request.args.get("content") or "Make it a Quote",
|
| 281 |
+
request.args.get("icon") or "https://cdn.discordapp.com/embed/avatars/0.png"
|
| 282 |
+
)
|
| 283 |
+
return send_file(res, mimetype="image/png")
|
| 284 |
+
|
| 285 |
+
|
| 286 |
@app.route("/white", methods=["GET"])
|
| 287 |
def white():
|
| 288 |
res = whiteMake(
|