I am using this block of code to send an image from python to display in HTML.
x = cv2.imread(file)
x = cv2.cvtColor(x, cv2.COLOR_RGB2BGR)
img = io.BytesIO()
x = Image.fromarray(x, 'RGB')
x.save(img, 'PNG')
img.seek(0)
array.append(base64.b64encode(img.getvalue()))
k= k+1
id.append(k)
render_template('html_page.html', data=zip(array,id))
Code to display in HTML page:
{%for i,j in data%}
<img for="id{{i}}" style = "float:left; width: 180px;" src="data:image/PNG;base64,{{ i }}" alt="display_Image">
{% endfor %}
The image is not getting displayed in the browser.
Can anyone point put what I am doing wrong? Trying to learn image processing with Python.
While debugging I am able to see that the image is getting loaded successfully in python function but is not getting displayed in HTML page.