Streamlit component that allows you to create button to paste image from clipboard.
Project description
streamlit-custom-component
Streamlit component that allows you to create button to paste image from clipboard.
confirmed that it works with chrome,safari,edge. it doesn't work with firefox
Installation instructions
pip install st_img_pastebutton
Usage instructions
import streamlit as st
from st_img_pastebutton import paste
from io import BytesIO
import base64
st.header("Image Clipboard Example")
st.write("Click the button below to upload an image from your clipboard.")
image_data = paste(label="paste from clipboard",key="image_clipboard")
if image_data is not None:
header, encoded = image_data.split(",", 1)
binary_data = base64.b64decode(encoded)
bytes_data = BytesIO(binary_data)
st.image(bytes_data, caption="Uploaded Image", use_column_width=True)
else:
st.write("No image uploaded yet.")
run
streamlt run examle.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
st_img_pastebutton-0.0.3.tar.gz
(424.5 kB
view hashes)
Built Distribution
Close
Hashes for st_img_pastebutton-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10e3b6b7ec00994d2faa5054397177cd3f356ea55926fe8fc8b456d3099f4998 |
|
MD5 | d73384b72b0f0405ab6ced9acfe78f09 |
|
BLAKE2b-256 | 4a06b8c1b8d2b4aea50ec3896414b03a30def4ad122561a0e979e6d0785f0a39 |