Streamlit component that allows you to select multiple images with a captivating interface
Project description
st-img-selector
A custom Streamlit component that allows you to display and select images in a grid layout with customizable borders, corner radius, selection color, and more.
Features
- Display images from local paths, URLs, or image objects (PIL, NumPy).
- Set the number of images to display per row.
- Customize the selection color, border thickness, and corner radius.
- Pre-select images by specifying default values.
- Return the indices of the selected images.
Installation Instructions
Install the component using pip:
pip install st-img-selector
Usage Instructions
Here’s a simple example of how to use st-img-selector in your Streamlit app:
import streamlit as st
from st_img_selector import st_img_selector
from PIL import Image
import numpy as np
# Example usage of the component
selected_indices = st_img_selector(
images=[
"images/image1.png",
"https://example.com/image.jpeg",
Image.open("images/image2.jpeg"),
np.array(Image.open("images/image4.jpeg")),
],
value=[2, 3], # Default selected images at positions 2 and 3
corner_radius=10,
selection_color="#FF0000",
img_per_row=2,
border_thickness=4,
max_row_height=200,
)
st.write("Selected image indices:", selected_indices)
Parameters
- images: List of images to display (can be local file paths, URLs, or image objects like PIL or NumPy arrays).
- value: List of default selected image indices.
- corner_radius: Radius of image corners (default is 10).
- selection_color: Color of the border around selected images (default is "#555555").
- img_per_row: Number of images to display per row (default is 4).
- border_thickness: Thickness of the border around selected images (default is 4).
- max_row_height: Maximum height for each row of images (default is 300px).
Output
- Returns a list of indices representing the selected images.
Example
You can integrate this component into your Streamlit app to allow users to select multiple images and perform operations on the selected ones.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
This Streamlit component is provided as is without support. Sorry :(
Created with ❤️ by Broccoloff
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file st_img_selector-0.0.2.tar.gz.
File metadata
- Download URL: st_img_selector-0.0.2.tar.gz
- Upload date:
- Size: 404.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
384ef4b818a1541de6077eb893c414d90cc372535fb538cd9bc04187cc677887
|
|
| MD5 |
b8fb311e3ba047cbfb97256b7695b637
|
|
| BLAKE2b-256 |
d58334e8539081508d5cc618da5218b1b57504fdcdf83f990cf7ab9bc60fc456
|
File details
Details for the file st_img_selector-0.0.2-py3-none-any.whl.
File metadata
- Download URL: st_img_selector-0.0.2-py3-none-any.whl
- Upload date:
- Size: 782.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
530d8dbdab7e67b5f7af708283c72d061f615b466c143e223018ae6c58b9c226
|
|
| MD5 |
5620bc91bda7ed28f28ca6749508fb1f
|
|
| BLAKE2b-256 |
cb1955695667b75729cd376ec84675639732858849345d4bd0480ad0c2d5d7e3
|