📷 St.camera_input - control resolution of uploaded image

I’m trying to get st.camera_input to work for my application. I can access the uploaded picture, so the core functionality works fine.
But I found that by default the dimensions/resolution of the picture depends on the camera element size in the browser window… usually the image is just too small.

How do I explicitly set the resolution of the uploaded picture (without changing the size of the element in browser)?

Update: Link to feature request on github

Update 2: some code to try for yourself:

import streamlit as st
from PIL import Image
import numpy as np

imgbuffer = st.camera_input('cam')

if imgbuffer:
    img = Image.open(imgbuffer)
    imgnp = np.array(img)
    st.write(imgnp.shape)

Thanks
Johannes

2 Likes

Same issue…I can’t get the maximum camera device resolution

Wondering if anyone has found a solution to this? Also how to switch between available inputs (back and front camera)

1 Like

now, I cannot allow access iphone camera…
It cannot work on the “setting”…

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.