Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
streamlit-paste-button
Advanced tools
Streamlit component that allows you to paste images from your clipboard into your app with a button click
Streamlit component that allows you to paste images from your clipboard into your app with a button click.
pip install streamlit-paste-button
paste_image_button
Create a button that can be used to paste an image from the clipboard.
streamlit_paste_button.paste_image_button(
label: str,
text_color: Optional[str] = "#ffffff",
background_color: Optional[str] = "#3498db",
hover_background_color: Optional[str] = "#2980b9",
key: Optional[str] = 'paste_button',
errors: Optional[str] = 'ignore'
) -> PasteResult
label
: str, required
text_color
: str, optional
#ffffff
background_color
: str, optional
#3498db
hover_background_color
: str, optional
#2980b9
key
: str, optional
paste_button
errors
: str, optional
ignore
ignore
: Ignores errors.raise
: Display errors as st.error
messages.PasteResult
The result of a paste operation.
image_data
: PIL.Image.Image or None
None
.Create a paste button that displays the pasted image when clicked.
import streamlit as st
from streamlit_paste_button import paste_image_button as pbutton
paste_result = pbutton("📋 Paste an image")
if paste_result.image_data is not None:
st.write('Pasted image:')
st.image(paste_result.image_data)
Create a paste button with a custom label and colors.
from streamlit_paste_button import paste_image_button as pbutton
paste_result = pbutton(
label="📋 Paste an image",
text_color="#ffffff",
background_color="#FF0000",
hover_background_color="#380909",
)
Create a paste button that displays errors as st.error
messages.
from streamlit_paste_button import paste_image_button as pbutton
paste_result = pbutton(
label="📋 Paste an image",
errors="raise",
)
PasteResult is a PIL.Image.Image object. It can be manipulated as such.
from streamlit_paste_button import paste_image_button as pbutton
import io
import base64
import numpy as np
paste_result = pbutton("📋 Paste an image")
if paste_result.image_data is not None:
# Convert to bytes
img_bytes = io.BytesIO()
paste_result.image_data.save(img_bytes, format='PNG')
img_bytes = img_bytes.getvalue() # Image as bytes
# Convert to base64
img_b64 = base64.b64encode(img_bytes).decode('utf-8') # Image as base64
# Convert to numpy array
img_np = np.array(paste_result.image_data) # Image as numpy array
FAQs
Streamlit component that allows you to paste images from your clipboard into your app with a button click
We found that streamlit-paste-button demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.