How to display BytesIO containing a PNG image in Jupyter/IPython
In IPython, you can use the Image() function to show an image:
display_bytesio_image.py
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():
display_bytesio_fromvalue.py
from IPython.display import Image
my_bio = ... # Insert your code here
Image(my_bio.getvalue())Check out similar posts by category:
Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow