How to display BytesIO containing a PNG image in Jupyter/IPython
In IPython, you can use the Image()
function to show an image:
from IPython.display import Image
Image(filename="img1.png")
But what if you don’t have the PNG data in a file but in a BytesIO
?
Use .getvalue()
:
from IPython.display import Image
my_bio = ... # Insert your code here
Image(my_bio.getvalue())