mirror of
https://github.com/Xevion/v1.xevion.dev.git
synced 2025-12-07 13:17:03 -06:00
PyCharm grand repo wide reformat with black formatter
This commit is contained in:
@@ -7,13 +7,13 @@ from PIL import Image, ImageDraw, ImageFont
|
||||
from app import app
|
||||
|
||||
|
||||
@app.route('/panzer/')
|
||||
@app.route('/panzer')
|
||||
@app.route('/panzer/<string>')
|
||||
@app.route('/panzer/<string>/')
|
||||
def panzer(string='bionicles are cooler than sex'):
|
||||
string = string.replace('+', ' ')
|
||||
string = string.replace('\n', '%0A')
|
||||
@app.route("/panzer/")
|
||||
@app.route("/panzer")
|
||||
@app.route("/panzer/<string>")
|
||||
@app.route("/panzer/<string>/")
|
||||
def panzer(string="bionicles are cooler than sex"):
|
||||
string = string.replace("+", " ")
|
||||
string = string.replace("\n", "%0A")
|
||||
image = create_panzer(string)
|
||||
return serve_pil_image(image)
|
||||
|
||||
@@ -21,12 +21,12 @@ def panzer(string='bionicles are cooler than sex'):
|
||||
def create_panzer(string):
|
||||
img = Image.open("./app/static/panzer.jpeg")
|
||||
draw = ImageDraw.Draw(img)
|
||||
font1 = ImageFont.truetype('./app/static/arial.ttf', size=30)
|
||||
draw.text((10, 20), 'Oh panzer of the lake, what is your wisdom?', font=font1)
|
||||
font2 = ImageFont.truetype('./app/static/arial.ttf', size=30)
|
||||
font1 = ImageFont.truetype("./app/static/arial.ttf", size=30)
|
||||
draw.text((10, 20), "Oh panzer of the lake, what is your wisdom?", font=font1)
|
||||
font2 = ImageFont.truetype("./app/static/arial.ttf", size=30)
|
||||
topleft = (250, 500)
|
||||
wrapped = wrap(string, width=25)
|
||||
wrapped = [text.replace('%0A', '\n') for text in wrapped]
|
||||
wrapped = [text.replace("%0A", "\n") for text in wrapped]
|
||||
for y, text in enumerate(wrapped):
|
||||
draw.text((topleft[0], topleft[1] + (y * 33)), text, font=font2)
|
||||
return img
|
||||
@@ -34,6 +34,6 @@ def create_panzer(string):
|
||||
|
||||
def serve_pil_image(pil_img):
|
||||
img_io = BytesIO()
|
||||
pil_img.save(img_io, 'JPEG', quality=50)
|
||||
pil_img.save(img_io, "JPEG", quality=50)
|
||||
img_io.seek(0)
|
||||
return flask.send_file(img_io, mimetype='image/jpeg')
|
||||
return flask.send_file(img_io, mimetype="image/jpeg")
|
||||
|
||||
Reference in New Issue
Block a user