Metadata-Version: 2.4
Name: random_image
Version: 0.0.3
Summary: Get a random image in Python.
Author-email: Taha Shieenavaz <tahashieenavaz@gmail.com>
Project-URL: Homepage, https://github.com/tahashieenavaz/random-image
Project-URL: Repository, https://github.com/tahashieenavaz/random-image
Project-URL: Documentation, https://github.com/tahashieenavaz/random-image#readme
Keywords: image,python,productivity
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: pillow
Requires-Dist: pyyaml

# random-image

Load a random image instantly for computer vision artisans.

## Installation

Use `pip`:

```bash
pip install random-image
```

### Installation From Source

```bash
git clone git@github.com:tahashieenavaz/random-image.git
pip install -e .
```

## Configuration

The `random_image()` function provides several configuration options to customize image selection, output format, and dimensions.

### Function Signature

```python
def random_image(
    category: Optional[str] = None,
    as_numpy: bool = False,
    as_tensor: bool = False,
    width: int = 300,
    height: int = 300,
    download: bool = False
):
```

### Parameters

| Parameter | Type | Default | Description |
|:----------|:-----|:--------|:------------|
| `category` | `Optional[str]` | `None` | Specifies the category from which to retrieve a random image. If omitted, an image is selected from any available category. |
| `as_numpy` | `bool` | `False` | If `True`, returns the image as a NumPy array. |
| `as_tensor` | `bool` | `False` | If `True`, returns the image as a PyTorch tensor. |
| `width` | `int` | `300` | Specifies the desired image width in pixels. |
| `height` | `int` | `300` | Specifies the desired image height in pixels. |
| `download` | `bool` | `False` | If true the random image will be downloaded and stored with a random name. |

### Usage Examples

```python
# Retrieve a random image using default settings
image = random_image()

# Retrieve an image from a specific category
image = random_image(category="nature")

# Retrieve an image as a NumPy array
image = random_image(as_numpy=True)

# Retrieve an image as a PyTorch tensor
image = random_image(as_tensor=True)

# Specify custom image dimensions
image = random_image(width=512, height=512)

# Get a random car image and save it on the disk
image = random_image(category="car", download=True)
```

## Supported Image Classes (Categories)

- car
- dog
- rabbit

## Copyright and Attribution

All images provided by this project are sourced from [Unsplash](https://unsplash.com/). We do not claim ownership or copyright over these images. All image rights remain with their respective original creators and are subject to Unsplash's licensing terms.

All other rights to this project are reserved by **Taha Shieenavaz**.
