Metadata-Version: 2.1
Name: st-img-selector
Version: 0.0.2
Summary: Streamlit component that allows you to select multiple images with a captivating interface
Home-page: 
Author: broccoloff
Author-email: 
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: streamlit>=0.63
Provides-Extra: devel
Requires-Dist: wheel; extra == "devel"
Requires-Dist: pytest==7.4.0; extra == "devel"
Requires-Dist: playwright==1.39.0; extra == "devel"
Requires-Dist: requests==2.31.0; extra == "devel"
Requires-Dist: pytest-playwright-snapshot==1.0; extra == "devel"
Requires-Dist: pytest-rerunfailures==12.0; extra == "devel"


# 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:

```sh
pip install st-img-selector
```

## Usage Instructions

Here’s a simple example of how to use `st-img-selector` in your Streamlit app:

```python
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*
