title: Why is base64encoded output different for the same image?
body: <p>This function below reads an image and converts it into base64 image string</p>
  
  <pre><code>def getBase64Image(filePath):
      with open(filePath, "rb") as img_file:
          my_string = base64.b64encode(img_file.read())
          my_string = my_string.decode('utf-8')
      return my_string
  </code></pre>
  
  <p>However, the function below take image as array(loaded from OpenCV) and converts it into base64 image string</p>
  
  <pre><code>def convertToBase64(image):
      image.tobytes()
      my_string = base64.b64encode(image)
      my_string = my_string.decode('utf-8')
      return my_string
  </code></pre>
  
  <p>The output string from the first function differs from the string produced by the second function. Why is that?</p>
  
  <p>Ideally, I want the second function to produce the same base64 string as the first function.</p>
  
  <p>Please, can someone guide me on how I can achieve this?</p>