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.3.0.tar.gz (67.6 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.3.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gen_art_framework-0.3.0.tar.gz
  • Upload date:
  • Size: 67.6 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.3.0.tar.gz
Algorithm Hash digest
SHA256 f88f84ed29130b15eee17711f4579b8df0d607745c9f460c37ee956f84b46502
MD5 8a74748e66830a85af6cf50f30e0c444
BLAKE2b-256 1fc6b613c43e883e2582ae0042f9adad5de149bf48852b52a83b9d15f5dec2aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for gen_art_framework-0.3.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.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for gen_art_framework-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59d1a585da7fccf2fc3963b00d14d2ba3ac936ee97a3e410087d6bafc703e3cb
MD5 ca683275ecfead768a981ce261735e74
BLAKE2b-256 aecce65e353e6362c001d63a6044e05846a4e0060823b86af1b4d1f04a79af0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for gen_art_framework-0.3.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