i am trying to save multiple Pictures in one Bytes object from BytesIO. And later on acces these Pictures again from bytes to Picture. But i certainly don't know much about bytes. Is there a way to put something after one Picture in to the Buffer that it later knows where the Picture ends? Client Side:
#cv2 Capture Frame
ret, frame = cls.__cap.read()
buf = BytesIO()
for i in range(10):
Image.fromarray(frame).save(buf, format='JPEG')
# Here the Logic for differentiating Pictures
body = buf.getvalue()
requests.post(url,data=body,headers={'content-type': 'application/x-image'})
Website Side:
images_as_bytes = BytesIO(flask.request.data)
for i in range(10):
# Here the Logic for differentiating Pictures
img = Image.open(images_as_bytes)
frame = np.asarray(img)
# process