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

Uploaded Python 3

File details

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

File metadata

  • Download URL: gen_art_framework-0.1.2.tar.gz
  • Upload date:
  • Size: 61.1 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.2.tar.gz
Algorithm Hash digest
SHA256 9fa774f36b07a563873b8b5d3640fccf7f7923e4975538fadda4daf9cbe5b024
MD5 1a4753cdd9d4ff213c1401865d1b523e
BLAKE2b-256 b37c923a207a338164f5f620eb8613fa3751ee71c803a9a288d9c8ce4f1f3e22

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for gen_art_framework-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3719caad820c16f3bf1dfaf678651ab3d7cdfc58c4c2a4cb1cd4a5532a3f0c41
MD5 16b7eef876b9feb6bc24ceff2f349431
BLAKE2b-256 295dafad55332b5d94874afa482e7a4debfe2df5391f1e1644baf304fa2a2847

See more details on using hashes here.

Provenance

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