https://github.com/erjieyong/streamlit-cropperjs
https://github.com/erjieyong/streamlit-cropperjs
streamlit-components
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/erjieyong/streamlit-cropperjs
- Owner: erjieyong
- License: mit
- Created: 2023-07-11T11:16:46.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-14T03:45:32.000Z (about 2 years ago)
- Last Synced: 2025-12-15T20:17:44.026Z (7 months ago)
- Topics: streamlit-components
- Language: Python
- Homepage: https://github.com/erjieyong/streamlit-cropperjs
- Size: 719 KB
- Stars: 10
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Streamlit-cropperjs
Integrating the amazing [cropperjs](https://github.com/fengyuanchen/cropperjs) with streamlit.
This streamlit module is primarily built with mobile usage in mind.

## Demo
Access the demo app here: [https://st-cropperjs.streamlit.app/](https://st-cropperjs.streamlit.app/)
## Installation
`pip install streamlit-cropperjs`
## Example
```
import streamlit as st
from streamlit_cropperjs import st_cropperjs
pic = st.file_uploader("Upload a picture", key="uploaded_pic")
if pic:
pic = pic.read()
cropped_pic = st_cropperjs(pic=pic, btn_text="Detect!", key="foo")
if cropped_pic:
st.image(cropped_pic, output_format="PNG")
```
## Features
- Crop and return image data
- Supports touch (mobile)
- Supports cropping on demand with a button (customised button text)
## Future Development
- Support for all cropperjs options
- Support for cropperjs v2
## References
[https://github.com/fengyuanchen/cropperjs](https://github.com/fengyuanchen/cropperjs)