I want to crop my image file using PIL library and display it using Flask and Jinja.
I have tried this code:
@bp.route('/media/<fname>')
def fetch_media(fname):
...
image = Image.open(path)
cropped_image = image.crop(box)
return cropped_image
This gives a TypeError:
The view function did not return a valid response. The return type must be a string, dict, tuple, Response instance, or WSGI callable, but it was a Image.
How can I return the Image to html page?