UnidentifiedImageError: cannot identify image file <_io.BytesIO object at

I have an image represented as a string like this:

Note that I don’t have any other option than this string version of my image.

I want to render this image using st.image() but I don’t know how. I have tried passing

st.image(bytes("my_string_as_image", "utf-8"))


import io
import PIL

image = PIL.image(io.BytesIO(bytes("my_string_as_image", "utf-8")))

but still getting the same error. Any ideas?