Metadata-Version: 2.4
Name: Pixslim
Version: 1.0.2
Summary: A lightweight Python package for compressing JPG, JPEG, and PNG images.
Author: Fatemeh SHM
License: MIT
Keywords: image,compress,compression,jpg,jpeg,png,pillow
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: Pillow>=10.0.0

# PixSlim

**PixSlim** is a lightweight and easy-to-use Python package for compressing **JPG**, **JPEG**, and **PNG** images while trying to reach a target file size.

## ✨ Features

- 📦 Compress JPG, JPEG, and PNG images
- 🎯 Target file size in KB
- 🖼️ Automatically reduces image dimensions if needed
- ⚡ Simple and beginner-friendly API
- 🐍 Built with Pillow

## Installation

```bash
pip install Pixslim
```

## Requirements

- Python 3.9+
- Pillow

## Usage

```python
from Pixslim import compressor

compressor = compressor(target_kb=500)

result = compressor.compress(
    "photo.png",
    "photo_small.png"
)

print(result)
```

Example output:

```python
{
    "original_kb": 1356.42,
    "final_kb": 492.18,
    "reduction_percent": 63.71,
    "quality": None,
    "size": (1920, 1080)
}
```

## Supported Formats

| Input | Output |
|--------|--------|
| JPG | JPG |
| JPEG | JPEG |
| PNG | PNG |

## Parameters

### Compressor(target_kb=500)

| Parameter | Type | Description |
|----------|------|-------------|
| target_kb | int | Desired maximum file size in KB |

### compress(input_file, output_file)

| Parameter | Type | Description |
|----------|------|-------------|
| input_file | str | Input image path |
| output_file | str | Output image path |

## Example

```python
from Pixslim import compressor

compressor = compressor(target_kb=300)

compressor.compress(
    "image.jpg",
    "image_small.jpg"
)
```

## License

This project is licensed under the MIT License.

## Author

**Fatemeh SHM**
