# `Slither.Examples.ImagePipeline.ThumbnailDemo`
[🔗](https://github.com/nshkrdotcom/slither/blob/v0.1.0/lib/slither/examples/image_pipeline/thumbnail_demo.ex#L1)

Demonstrates why process isolation beats free-threaded Python for image work.

Generates 30 test images (up to 4K resolution) in Python via Pillow, then
creates thumbnails using the `WeightedBatch` strategy where batch boundaries
are determined by total pixel count.  After processing, collects per-worker
memory statistics to show that Slither's backpressure kept peak memory bounded.

## Why This Exists

Under free-threaded Python (PEP 703):
  - Pillow's C internals (libImaging) are not thread-safe; concurrent
    `Image.resize(LANCZOS)` can produce corrupted output or segfault
  - No built-in backpressure means 16 threads each loading a 4K image
    = 500MB+ memory spike
  - One thread's segfault kills ALL threads

Under Slither:
  - `WeightedBatch` groups images by pixel count so large images get
    their own batch
  - `max_in_flight: 2` caps concurrent batches (backpressure)
  - Each Python worker is a separate OS process, so Pillow is safe
  - A crash in one worker does not affect others

Run with:

    Slither.Examples.ImagePipeline.ThumbnailDemo.run_demo()

# `run_demo`

Run the full image thumbnail demo, printing results to stdout.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
