Greedytile
Random greedy pixel pattern generation algorithm
Install / Use
/learn @GeEom/GreedytileREADME
GreedyTile
Fast pattern synthesis preserving local tile constraints. Safe Rust implementation with CLI and library interfaces.
Examples
| Source | Generated | Visualized |
|--------|-----------|------------|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Installation and usage
# Install with Rust 1.88.0 or later
cargo install greedytile
# Generate pattern from source image
greedytile input.png
# Process directory of images including rotation, mirroring, and animation
greedytile ./patterns/ -r -m -v
Options
| Option | Description | Default | Without Option | With Option |
|----------|-------------|---------|----------------|-------------|
| --seed | Seed reproducible generation | 42 |
|
|
| --iterations | Maximum iterations| 1000 |
|
|
| --prefill | Use content of <input>_pre.png | disabled |
|
|
| --visualize | Generate placement animation | disabled | |
|
| --width | Maximum pixel width | unbounded |
|
|
| --height | Maximum pixel height | unbounded | | |
| --rotate | Enable 90°/180°/270° tile rotations | disabled |
|
|
| --mirror| Enable tile reflection | disabled |
|
|
| --quiet | Suppress progress output | verbose |
| --no-skip | Process overwriting existing output | skip existing |
Details
GreedyTile generates patterns by placing 3×3 tiles extracted from a source image. Weights for randomly selecting placement are influenced by several factors:
- Entropy weighting: Prioritizes positions where fewer tile options are valid (similar to WFC)
- Global balance correction: If pixels are under-represented then selection is biased towards the source balance
- Distance-based probabilities: Pixel distance patterns in the source are replicated in the output
- Deadlock recovery: If no choices exist which respect tiles, pixels in a local area are removed before continuing
Commentary
For efficiency, the global balance correction uses a normal distribution to approximate what should technically be a binomial distribution. The approximation becomes accurate at large counts where it matters most.
The distance probability weighting has more impact on easily tiled patterns than complex ones. Restrictive patterns often have less valid tile choices, making the probabilistic selection less relevant.
Limitations
- Fixed tile size: Currently hardcoded to sample 3×3 pixel tiles from the source
- Extensibility: Would be improved by a plugin interface for adding new probability rules
Related Skills
himalaya
352.2kCLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).
node-connect
352.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
taskflow
352.2kname: taskflow description: Use when work should span one or more detached tasks but still behave like one job with a single owner context. TaskFlow is the durable flow substrate under authoring layer
frontend-design
111.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
