Sending multiple images FROM python server TO the react front [duplicate] Sending multiple images FROM python server TO the react front [duplicate] flask flask

Sending multiple images FROM python server TO the react front [duplicate]


In python encode the image to base64:

import base64with open("yourfile.ext", "rb") as image_file:    encoded_string = base64.b64encode(image_file.read())

In js decode the image:

var image = new Image();image.src = 'data:image/png;base64,iVBORw0K...';


I am trying to send 2 pngs(or jpeg or any other format) images from my Flask server to my Reactjs front to display them there.

Maybe this article could be helpful for you.

Your Flask server needs to expose a API where your React Frontend can then send data to.