diff --git a/src/requirements.txt b/src/requirements.txt index c6adef4..a47ff7a 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -38,3 +38,4 @@ tzdata==2025.1 urllib3==2.3.0 Werkzeug==3.1.3 zipp==3.21.0 +pillow==11.1.0 diff --git a/src/routes.py b/src/routes.py index ccdcfb3..fe4fe97 100644 --- a/src/routes.py +++ b/src/routes.py @@ -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 oidc @@ -6,3 +7,17 @@ from app import oidc @app.route('/') def index(): 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') +