Browse Source

send as jpeg to save data

master
Ruben van de Ven 3 years ago
parent
commit
059f67e736
  1. 8
      portrait_compositor.py

8
portrait_compositor.py

@ -12,6 +12,7 @@ import thread @@ -12,6 +12,7 @@ import thread
from websocket import create_connection
import logging
import json
from io import BytesIO
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger('portraits')
@ -78,10 +79,15 @@ def updateStats(type, name, count, image_filename): @@ -78,10 +79,15 @@ def updateStats(type, name, count, image_filename):
# only send every one in x image, so that the server never can
# retrace _exact_ faces by comparing the sent frames.
with open(image_filename) as fp:
im = Image.open(fp)
bytesImg = BytesIO()
im.save(bytesImg, format='jpeg')
bytesImg.seek(0)
logger.info('send request including image')
r = requests.post(
url ,
files={'image': fp},
files={'image': bytesImg},
params=params
)
else:

Loading…
Cancel
Save