Files
2026-05-30 11:33:07 +02:00

79 lines
1.9 KiB
Markdown

# Image Pipeline
Modular Python framework for chaining image processing steps after Darktable export.
Each pipeline is a Python script that defines a DAG of processing steps. Every step writes its output to a numbered subfolder inside a timestamped run directory.
## Requirements
- Python 3.11+
- [ImageMagick](https://imagemagick.org/) (`magick` or `convert` on PATH)
## Installation
```bash
cd /path/to/imagepipeline
pip install -e ".[dev]"
```
## Quick Start
Edit the input path in `pipelines/example_grayscale.py`, then run:
```bash
python pipelines/example_grayscale.py
```
Or from Python:
```python
from pathlib import Path
from imagepipeline import Pipeline
with Pipeline(name="my_run", input_dir=Path("/path/to/export")) as p:
gray = p.step("imagemagick_grayscale", inputs="input")
p.run()
```
## Output Structure
Each run creates a folder like `my_run_20260527143022/`:
```
my_run_20260527143022/
├── pipeline_manifest.json
├── input/ # symlinks to source images
├── imagemagick_grayscale_01/
│ └── photo.jpg
└── ...
```
Step folders are named `{module_name}_{nn}` (two-digit counter per module name).
## Writing Pipelines
Pipelines are plain Python scripts. Reference previous steps via `StepRef` objects returned by `p.step()`:
```python
with Pipeline(name="colorsplash", input_dir=INPUT) as p:
rembg_out = p.step("rembg", inputs="input")
bw = p.step("imagemagick_grayscale", inputs="input")
combined = p.step("composite", inputs=[bw, rembg_out], mode="foreground_over")
p.step("darktable_style", inputs=combined, style="vintage.dtstyle")
p.run()
```
- `"input"` refers to the original input directory
- Parameters are passed as kwargs and validated against each module's schema
- Multiple uses of the same module get separate numbered folders
## Adding Modules
See [docs/MODULE_DEVELOPMENT.md](docs/MODULE_DEVELOPMENT.md).
## Tests
```bash
pytest
```