Flask python Send and Receive Images in Bytes : i try to send and receive image using python and flask
 
Below is my current solution that does not work

flask 

    app = Flask(__name__)

    @app.route('/add_face', methods=['GET', 'POST'])

    def add_face():

    if request.method == 'POST':

        #  read encoded image

        imageString = base64.b64decode(request.form['img'])

        #  convert binary data to numpy array

        nparr = np.fromstring(imageString, np.uint8)

        #  let opencv decode image to correct format

        img = cv2.imdecode(nparr, cv2.IMREAD_ANYCOLOR);

        cv2.imshow("frame", img)

        cv2.waitKey(0)

    return "list of names & faces"

    if __name__ == '__main__':

    app.run(debug=True, port=5000)


client

    URL = "http://localhost:5000/add_face"

    #first, encode our image with base64

    with open("block.png", "rb") as imageFile:

    img = base64.b64encode(imageFile.read())

    response = requests.post(URL, data={"name":"obama", "img":str(img)})

    print(response.content)

this the error is very bigger which that contain html script that i can not understand it
      return binascii.a2b_base64(s)\nbinascii.Error: Incorrect padding\n\n-->\n' 


