Skip to main content

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.

Videotogif (21)

confirmed that it works with chrome,safari,edge. it doesn't work with firefox

Installation instructions

pip install st_img_pastebutton

or

pip install st_img_pastebutton --upgrade

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


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.6.tar.gz (424.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

st_img_pastebutton-0.0.6-py3-none-any.whl (824.7 kB view details)

Uploaded Python 3

File details

Details for the file st_img_pastebutton-0.0.6.tar.gz.

File metadata

  • Download URL: st_img_pastebutton-0.0.6.tar.gz
  • Upload date:
  • Size: 424.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.9

File hashes

Hashes for st_img_pastebutton-0.0.6.tar.gz
Algorithm Hash digest
SHA256 fbccd6b3bac0bece7101c0af9efe9359c9947f36be4c20b249bceabab704d1de
MD5 ea94a143f2e074fadb9d0e6e4c9cc50e
BLAKE2b-256 ab9751a3819e63e2d69d8f5951700190436996daacb10c7c51e73463de25d527

See more details on using hashes here.

File details

Details for the file st_img_pastebutton-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for st_img_pastebutton-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 77ebe9044fe499ac195d3e6baa98521ebb510ad5573c046247e05074b81acd2f
MD5 4774cb44b95f2229652ee7096e53c89d
BLAKE2b-256 76d97060e6015326a1c42a8330396613d94ee99bfc23a548b9960966fa2ecd9d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page