Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How to return images in flask response?

from flask import send_file

@app.route('/get_image')
def get_image():
    if request.args.get('type') == '1':
       filename = 'ok.gif'
    else:
       filename = 'error.gif'
    return send_file(filename, mimetype='image/gif')
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #return #images #flask
ADD COMMENT
Topic
Name
5+5 =