Skip to main content

A framework for creating generative art with Python

Project description

gen-art-framework

CI

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.

Contributing

Development Workflow

  1. Create a PR with your changes
  2. CI will run tests, linting, and formatting checks
  3. Once approved and merged to main, your changes are in the codebase
  4. When ready to release, create and push a version tag:
    git tag v0.1.3        # Use semantic versioning: vMAJOR.MINOR.PATCH
    git push origin v0.1.3
    
  5. The tag push automatically triggers a build and publishes to PyPI

Version numbering:

  • patch (v0.1.1 → v0.1.2) for bug fixes
  • minor (v0.1.1 → v0.2.0) for new features
  • major (v0.1.1 → v1.0.0) for breaking changes

CI checks:

  • Tests must pass
  • No linting errors
  • Code must be properly formatted

Run checks locally:

  • just test - run tests
  • just lint - check linting
  • just fmt - format code
  • just check - format and lint together

Documentation

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

gen_art_framework-0.2.0.tar.gz (65.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gen_art_framework-0.2.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file gen_art_framework-0.2.0.tar.gz.

File metadata

  • Download URL: gen_art_framework-0.2.0.tar.gz
  • Upload date:
  • Size: 65.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gen_art_framework-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8b3944d68cb8e93b900b8b2c423b1b701d4a82884df11caa1b021b4d8de01c22
MD5 5efc44b599dd872fdd052939d378dd93
BLAKE2b-256 9c08e64932a8f48e61120eba574b1cd440000675e85116f3f317488e593f8bcc

See more details on using hashes here.

Provenance

The following attestation bundles were made for gen_art_framework-0.2.0.tar.gz:

Publisher: publish.yml on josh-gree/gen-art-framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gen_art_framework-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for gen_art_framework-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fabada40ce1d7d8c4168c0fdf1a724212f8d81da6fda08454000570fad07851b
MD5 c52c5953cb9d4f5918b0938594bb6815
BLAKE2b-256 d1c8b4e6039cb9b35adb73e13036f14c91c019bbf6fbb4710f9957f18afc52dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for gen_art_framework-0.2.0-py3-none-any.whl:

Publisher: publish.yml on josh-gree/gen-art-framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page