Getting "TypeError: a bytes-like object is required, not 'DeltaGenerator'" when using Pillow and Streamlit

Hello everyone. I’m using Pillow within streamlit in Python and I try to load an image with the following code

img_form = + "/images/1.jpg")

And I get the following error

2022-06-30 19:47:28.483 Uncaught app exception
Traceback (most recent call last):
  File "/home/asdru/.cache/pypoetry/virtualenvs/streamlit-test-2drTybIu-py3.10/lib/python3.10/site-packages/streamlit/scriptrunner/", line 554, in _run_script
    exec(code, module.__dict__)
  File "/home/asdru/projects/streamlit-test/streamlit_test/", line 65, in <module>
  File "/home/asdru/.cache/pypoetry/virtualenvs/streamlit-test-2drTybIu-py3.10/lib/python3.10/site-packages/streamlit/elements/", line 138, in image
  File "/home/asdru/.cache/pypoetry/virtualenvs/streamlit-test-2drTybIu-py3.10/lib/python3.10/site-packages/streamlit/elements/", line 423, in marshall_images
    proto_img.url = image_to_url(
  File "/home/asdru/.cache/pypoetry/virtualenvs/streamlit-test-2drTybIu-py3.10/lib/python3.10/site-packages/streamlit/elements/", line 353, in image_to_url
    (data, mimetype) = _normalize_to_bytes(data, width, output_format)
  File "/home/asdru/.cache/pypoetry/virtualenvs/streamlit-test-2drTybIu-py3.10/lib/python3.10/site-packages/streamlit/elements/", line 240, in _normalize_to_bytes
    image =
TypeError: a bytes-like object is required, not 'DeltaGenerator'

I also tried opening the file using the following code and I get the same error.

img_form = + "/images/1.jpg", "rb"))

Any help solving this is appreciated. For reference I’m using the following versions of these packages:

streamlit → "1.10.0"
Pillow → "9.1.1"

Also my Python version is 3.10.5. I’m using Manjaro Linux with kernel version5.18.6-1-MANJARO

Oh, I was using a different variable, that came from st.columns call, please ignore