25 lines
544 B
Python
25 lines
544 B
Python
from flask import abort, Response
|
|
from PIL import Image, ImageDraw
|
|
import io
|
|
from app import app
|
|
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')
|
|
|