pillow
This commit is contained in:
parent
7ff1b70098
commit
b3c2c7794a
@ -38,3 +38,4 @@ tzdata==2025.1
|
|||||||
urllib3==2.3.0
|
urllib3==2.3.0
|
||||||
Werkzeug==3.1.3
|
Werkzeug==3.1.3
|
||||||
zipp==3.21.0
|
zipp==3.21.0
|
||||||
|
pillow==11.1.0
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from flask import abort
|
from flask import abort, Response
|
||||||
|
from PIL import Image, ImageDraw
|
||||||
from app import app
|
from app import app
|
||||||
from app import oidc
|
from app import oidc
|
||||||
|
|
||||||
@ -6,3 +7,17 @@ from app import oidc
|
|||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
|
@app.route('/generate_image')
|
||||||
|
def generate_image():
|
||||||
|
img = Image.new('RGB', (200, 100), color=(255, 255, 255))
|
||||||
|
|
||||||
|
draw = ImageDraw.Draw(img)
|
||||||
|
draw.text((50, 40), "Hello, Flask!", fill=(0, 0, 0)) # Schwarzer Text
|
||||||
|
|
||||||
|
img_io = io.BytesIO()
|
||||||
|
img.save(img_io, 'PNG')
|
||||||
|
img_io.seek(0) # Zeiger zurücksetzen
|
||||||
|
|
||||||
|
return Response(img_io, mimetype='image/png')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user