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.1.3.tar.gz (62.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.1.3-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gen_art_framework-0.1.3.tar.gz
  • Upload date:
  • Size: 62.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.1.3.tar.gz
Algorithm Hash digest
SHA256 11695ef7a167649a3f599b5318b3c6aec146923b96bf4e06d5c7f7fda6607f92
MD5 d209469bec9ab55e9e1922a600c9a366
BLAKE2b-256 78ad61daffb980b241b74ef7a827f578d4f4ee486ad93563444d3704d874b61f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for gen_art_framework-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c6719cabae38db8f2bca8c0e903ce1d574fa15248c6ef7ef022cae835d530a94
MD5 c1803095e930f58a7dccd7e1502c8726
BLAKE2b-256 ba4553491a817438020641060a3c1818045cb67fd099f69e27b2dcfa78545299

See more details on using hashes here.

Provenance

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