Streamlit-cropperjs: A new way to crop images!

Hello everyone,

I have had the pleasure to try out streamlit-cropper by turner-anderson. It is a wonderful module for all computer vision projects! Unfortunately, I faced some issue getting the module to work properly on mobile.

As such, I took some time to integrate another amazing project from fengyuanchen: cropperjs using streamlit components.

Have released the component on pypi and can be easily installed via
pip install streamlit-cropperjs

Check out the repo at streamlit-cropperjs (github.com)

1 Like

Hi @erjieyong,

Thanks for sharing! Pretty cool component! I would recommend deploying a demo app of the component that the community can play with for preview.

Thanks @tonykip for the suggestion!

Have deployed a demo app over at this link: streamlit-cropperjs

1 Like

Hi @erjieyong,

Great! Looks good!

Great App​:+1:t2::+1:t2::+1:t2:.

If u could provide download option for cropped image it would be very helpful.

One suggestion : if the user upload different format than the specified format, app should alert the user to upload the correct format. (Error info)

1 Like

Thanks! I’ve updated the component’s return value to allow easy and direct use of the st.download_button functionality.

cropped_pic = st_cropperjs(pic=pic, btn_text="Detect!", key="foo")
if cropped_pic:
    st.image(cropped_pic, output_format="PNG")
    st.download_button(
        "Download", cropped_pic, file_name="output.png", mime="image/png"
    )