A simple image cropper for Streamlit
Project description
Streamlit - Cropper
A streamlit custom component for easy image cropping
Installation
pip install streamlit-cropper
Example Usage
import streamlit as st
from streamlit_cropper import st_cropper
from PIL import Image
st.set_option('deprecation.showfileUploaderEncoding', False)
# Upload an image and set some options for demo purposes
st.header("Cropper Demo")
img_file = st.sidebar.file_uploader(label='Upload a file', type=['png', 'jpg'])
realtime_update = st.sidebar.checkbox(label="Update in Real Time", value=True)
box_color = st.sidebar.beta_color_picker(label="Box Color", value='#0000FF')
if img_file:
img = Image.open(img_file)
if not realtime_update:
st.write("Double click to save crop")
# Get a cropped image from the frontend
cropped_img = st_cropper(img, realtime_update=realtime_update, box_color=box_color)
# Manipulate cropped image at will
st.write("Preview")
_ = cropped_img.thumbnail((150,150))
st.image(cropped_img)
References
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
streamlit-cropper-0.1.0.tar.gz
(937.0 kB
view hashes)
Built Distribution
Close
Hashes for streamlit_cropper-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e246e52f42cb0a6a527b8c3211f9f567b5f2c8eaea356b783a7d2593e392f6be |
|
MD5 | 90a6d092757b0e8d5ee7ed563e7f495b |
|
BLAKE2b-256 | de77032aeeb8d0a4b7376077edf598b68c230b97fd3f5a3edc891585f98ce7c3 |