Skip to main content

Generate ICRL thought-of-the-day images using LiteLLM, PIL, and Typer.

Project description

ICRL Image Generator

This project generates "thought of the day" images for the International Consciousness Research Laboratories (ICRL).
It uses LiteLLM to:

  1. Turn a text thought into an image prompt
  2. Generate an AI image
  3. Blend the generated image with an overlay image

The script is exposed as a command-line tool using Typer.


Features

  • Generate text-to-image prompts using LiteLLM (completion)
  • Produce images using LiteLLM (image_generation)
  • Blend generated images with overlay images using configurable alpha values
  • Batch process multiple thoughts from CSV files
  • Save:
    • the final blended image
    • the raw generated image (optional)
    • the generated image prompt (optional)
  • Easy CLI interface

Installation

git clone https://github.com/HonakerM/icrl-generator.git
cd icrl-generator
pip install .

Usage

CLI - Single Image Generation

After installation, you can run the following command to generate an image.

Linux:

export OPENAI_API_KEY="<openai-api-key>"
python -m icrl_generator generate-image \
    "Never assume that what you see on a person's face is what lies in their heart." \
    overlay.png \
    output.png \
    --image-prompt-output image-prompt.txt \
    --raw-image-output raw_image.png \
    --log-level DEBUG \
    --alpha 50

Windows:

$env:OPENAI_API_KEY = "<openai-api-key>"   
python -m icrl_generator generate-image `
    "Never assume that what you see on a person's face is what lies in their heart." `
    overlay.png `
    output.png `
    --image-prompt-output image-prompt.txt `
    --raw-image-output raw_image.png `
    --log-level DEBUG `
    --alpha 50

To view all options and their descriptions:

python -m icrl_generator generate-image --help

CLI - Batch Generation

To generate multiple images from a CSV file:

Linux:

export OPENAI_API_KEY="<openai-api-key>"
python -m icrl_generator generate-batch \
    thoughts.csv \
    overlay.png \
    output_folder \
    --include-image-prompt \
    --include-raw-image \
    --log-level INFO \
    --alpha 50

Windows:

$env:OPENAI_API_KEY = "<openai-api-key>"
python -m icrl_generator generate-batch `
    thoughts.csv `
    overlay.png `
    output_folder `
    --include-image-prompt `
    --include-raw-image `
    --log-level INFO `
    --alpha 50

The CSV file should have thoughts in column 2 (index 1) and publish dates in the second-to-last column in YYYY-MM-DD format.

To view all options:

python -m icrl_generator generate-batch --help

Code

If you want to call it from Python directly:

from pathlib import Path
from icrl_generator import generate_image

generate_image(
    thought="Reality responds to our expectations.",
    overlay=Path("overlay.png"),
    output=Path("out.png"),
    image_prompt_output=Path("prompt.txt"),
    raw_image_output=Path("raw.png"),
    alpha=50
)

Alpha Blending

The --alpha parameter controls the blend between the generated image and the overlay:

  • 0: Fully generated image (no overlay)
  • 50: Equal blend (default)
  • 100: Fully overlay image (no generated image visible)

Results

./image.png

Requirements

  • Python 3.10+
  • LiteLLM API keys properly configured (export OPENAI_API_KEY=...)
  • Pillow
  • Typer
  • tqdm (for batch processing progress bars)

Command Reference

generate-image

Generate a single image with overlay blending.

Arguments:

  • THOUGHT: The thought text to generate an image for
  • OVERLAY: Path to overlay image to blend with generated image
  • OUTPUT: Path to save the final blended image

Options:

  • --image-prompt-output PATH: Save the generated image prompt
  • --raw-image-output PATH: Save the raw image before blending
  • --log-level: Set logging level (default: INFO)
  • --prompt-gen-model TEXT: LLM model for prompt generation (default: gpt-4o-mini)
  • --image-gen-model TEXT: Image generation model (default: gpt-image-1-mini)
  • --alpha INTEGER: Blend alpha value 0-100 (default: 50)

generate-batch

Generate multiple images from a CSV file.

Arguments:

  • INPUT: Path to CSV file with thoughts and publish dates
  • OVERLAY: Path to overlay image to blend with all generated images
  • OUTPUT_FOLDER: Folder to save generated images

Options:

  • --include-image-prompt/--no-include-image-prompt: Save image prompts (default: no)
  • --include-raw-image/--no-include-raw-image: Save raw images (default: no)
  • --log-level: Set logging level (default: INFO)
  • --prompt-gen-model TEXT: LLM model for prompt generation (default: gpt-4o-mini)
  • --image-gen-model TEXT: Image generation model (default: gpt-image-1-mini)
  • --alpha INTEGER: Blend alpha value 0-100 (default: 50)

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

icrl_generator-0.0.7.tar.gz (9.2 MB view details)

Uploaded Source

Built Distribution

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

icrl_generator-0.0.7-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file icrl_generator-0.0.7.tar.gz.

File metadata

  • Download URL: icrl_generator-0.0.7.tar.gz
  • Upload date:
  • Size: 9.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for icrl_generator-0.0.7.tar.gz
Algorithm Hash digest
SHA256 4155b8408edf234e8943c9fe2a32537dbd6e2254999ff1ca514c9a7b81e4a5c7
MD5 268d1ab7185f557b8072b3935c6204b3
BLAKE2b-256 831e8b2af46234bf6ea0662f9fb45abbc1c3fa2c203b8ad4a4b6a0dc5a365af7

See more details on using hashes here.

Provenance

The following attestation bundles were made for icrl_generator-0.0.7.tar.gz:

Publisher: publish.yml on HonakerM/icrl-generator

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

File details

Details for the file icrl_generator-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: icrl_generator-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for icrl_generator-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f60fd5cc44865fda5fe391e6121e3990da142df59e8f9b7da35a3f19b07ca84c
MD5 b37f67e613fc2510da06f68406157299
BLAKE2b-256 dbc299117894a2819847f43fc6ab163ea341720d89787b09eefe7c7fe24aea65

See more details on using hashes here.

Provenance

The following attestation bundles were made for icrl_generator-0.0.7-py3-none-any.whl:

Publisher: publish.yml on HonakerM/icrl-generator

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