A framework for creating generative art with Python
Project description
gen-art-framework
A Python framework for generating art from parameterised scripts. Define parameter distributions in YAML, and the framework samples from them to create unique variations of your artwork.
Installation
pip install gen-art-framework
Or with uv:
uv add gen-art-framework
Quick Start
Create a script with a YAML parameter block in its docstring:
"""
parameters:
- name: seed
distribution: constant
value: 42
- name: width
distribution: constant
value: 800
- name: height
distribution: constant
value: 600
- name: num_circles
distribution: randint
low: 20
high: 50
- name: colour
distribution: choice
values: ["#e94560", "#f39c12", "#00b894"]
"""
from PIL import Image, ImageDraw
import random
random.seed(seed)
img = Image.new("RGB", (width, height), "#1a1a2e")
draw = ImageDraw.Draw(img)
for _ in range(num_circles):
x = random.randint(0, width)
y = random.randint(0, height)
r = random.randint(10, 50)
draw.ellipse([x - r, y - r, x + r, y + r], fill=colour)
img
Generate images using the CLI:
# Generate a single image
gen-art sample my_script.py
# Generate 10 variations
gen-art sample my_script.py --count 10
# Specify output directory and seed for reproducibility
gen-art sample my_script.py -n 5 -o ./output -s 42
Output files are named {script_name}_{index}_{seed}.png.
Documentation
- CLI Usage - Command-line interface reference
- Writing Scripts - How to write parameterised art scripts
- Distributions - Available parameter distributions
- Python API - Programmatic usage
- Examples - Walkthrough of example scripts
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gen_art_framework-0.1.1.tar.gz.
File metadata
- Download URL: gen_art_framework-0.1.1.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5f1ecf3e88e9722953aa284d51142a14bf39d1fec710b250860d1fb7a5aad12
|
|
| MD5 |
b0466cdfa7660864bfbb80a93c0c5037
|
|
| BLAKE2b-256 |
8e794d7f38de3ae66e5f0d0e3a07b8aa0c75d41a0f3cd876a0290a7ed10fbdde
|
File details
Details for the file gen_art_framework-0.1.1-py3-none-any.whl.
File metadata
- Download URL: gen_art_framework-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f55b4b3006829c2c6f4e42e7b81fdeaf13914ebf6bfb248030b1e03baf58589
|
|
| MD5 |
bf8c6aebbf2f45ba6b6beeb2aa6fac49
|
|
| BLAKE2b-256 |
def10beb940e1a203578344b3c3c68395d01eeb6d366d60868733541bf25be92
|