I'm trying to write a image resizer with Python 3.8 and Quart 0.19.4, here's the code :
@app.route('/screenshots/th', methods=['POST'])
async def getScreenshotsThumbnails():
body = await request.get_data()
data = json.loads(body)
img = cv2.imread(f"{OUT_PATH}/{data['session']}/{data['filename']}")
resizedImg = cv2.resize(img, (data['width'], data['height']), interpolation=cv2.INTER_CUBIC)
result, png = cv2.imencode('.png', resizedImg)
return Response(response=png, status=200, mimetype='image/png', content_type='image/png')
Everything is ok, unless the last line. The png variable contains for example 20Kb of data, but I receive about 2.5Mb of data... I tried many things but I always received 2.5Mb
What am I doing wrong ?
Thanks