Metadata-Version: 2.4
Name: sketchflow
Version: 1.1.2
Summary: A Python library for pencil sketch image processing and drawing animation
Author: Jai Akash
License-Expression: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: numpy
Requires-Dist: opencv-python
Provides-Extra: animation
Requires-Dist: pygame; extra == "animation"

# SketchFlow

SketchFlow is a Python library that converts images into pencil sketches and provides image preview, saving, and drawing animation features.

## Features

- Load images from file paths.
- Support image paths containing Unicode characters.
- Convert images into graphite-style pencil sketches.
- Customize sketch processing parameters.
- Preview sketches in an OpenCV window.
- Save sketches in supported image formats.
- Open saved sketches using the operating system's default image viewer.
- Animate the drawing process using Pygame.
- Adjust animation speed, pause, restart, and save frames.

## Requirements

- Python 3.10 or later
- NumPy
- OpenCV

Pygame is optional and is required only for drawing animation.

## Installation

Install SketchFlow from PyPI:

```bash
pip install sketchflow
```

For drawing animation support:

```bash
pip install "sketchflow[animation]"
```

## Quick Start

```python
import sketchflow

image = sketchflow.read("photo.jpg")

image.show()
```

## Save a Sketch

```python
import sketchflow

image = sketchflow.read("photo.jpg")

image.save("output.png")
```

## Open a Sketch

Save the processed sketch and open it with your operating system's default image viewer:

```python
import sketchflow

image = sketchflow.read("photo.jpg")

image.open("output.png")
```

## Customize Sketch Settings

Use `set_options()` to customize the sketch processing parameters.

```python
import sketchflow

image = sketchflow.read("photo.jpg")

image.set_options(
    blur_kernel=25,
    dodge_strength=260.0,
    contrast_gamma=1.25,
    edge_blend=0.30,
    grain_strength=10,
    paper_texture_strength=0.14
)

image.show()
```

### Available Options

| Option | Description |
|---|---|
| `blur_kernel` | Controls the blur kernel size used in sketch processing |
| `dodge_strength` | Controls the dodge effect |
| `contrast_gamma` | Adjusts image contrast through gamma correction |
| `edge_blend` | Controls the blending of detected edges |
| `grain_strength` | Controls the amount of grain |
| `paper_texture_strength` | Controls the paper texture effect |

## Drawing Animation

Install the optional animation dependency:

```bash
pip install "sketchflow[animation]"
```

Then run:

```python
import sketchflow

image = sketchflow.read("photo.jpg")

image.draw()
```

### Animation Controls

| Key | Action |
|---|---|
| `SPACE` | Pause or resume |
| `R` | Restart animation |
| `H` | Show or hide the HUD |
| `+` / `-` | Increase or decrease animation speed |
| `S` | Save the current sketch frame |
| `ESC` | Exit animation |

## Supported Output

The `save()` method uses the filename extension to select the output format. For example:

```python
image.save("output.png")
image.save("output.jpg")
```

Supported formats depend on the installed OpenCV image encoders.

## License

MIT License.
