drostescher / README.md
x
eafef
ad4deb5
---
title: Drostescher
emoji: 🐨
colorFrom: pink
colorTo: blue
sdk: gradio
sdk_version: 6.12.0
app_file: app.py
pinned: false
short_description: apply the Droste / logarithmic-spiral zoom effect
---
# πŸŒ€ Droste Effect
Upload any image (works best with logos or images that have a transparent background)
and apply the **Droste / logarithmic-spiral zoom** effect.
## Features
| Mode | Output |
|------|--------|
| **Still** | Single warped frame (PNG) |
| **Animation** | Seamlessly looping GIF zoom |
## Parameters
- **Width / Height** – output resolution
- **Frames** – number of animation frames (more = smoother, slower)
- **Rotations per loop** – how many full turns the spiral completes in one loop
- **FPS** – playback speed of the exported GIF
## How it works
1. Each pixel `(t, l)` is mapped to normalised Cartesian space `(y, x) ∈ [-1,1]²`.
2. Polar coordinates `(r, a)` are computed, then `logr = logβ‚‚(r)`.
3. The angle modulates the log-radius: `logr -= na` (turns circles into a spiral).
4. `logr` is folded into `[-1, 0)` so the image tiles seamlessly across octaves.
5. The inverse transform reconstructs pixel addresses, with transparent pixels
resolved by stepping one octave inward until opaque colour is found.
The animation adds a time offset `s ∈ [0,1)` to both `logr` and `na`, producing
a perfectly looping zoom-rotation.
## Local usage
```bash
pip install gradio numpy numba Pillow
python app.py
```