Skip to content

Repository files navigation

Oilrig — News Story → Poster Generator

A ComfyUI custom node + script that turns a news story's text into a finished poster: a generated illustration with a styled headline/caption banner underneath.

How it works

  1. Two ComfyUI workflows (prompt-gen.json, caption-gen.json) run the story through Comfy's built-in TextGenerate node (Qwen3-4B) to produce (a) a rich image-generation prompt, and (b) a short headline + body caption.
  2. A third workflow (t2i.json) generates a 1024x1024 image from that prompt (Z-Image-Turbo / Lumina2).
  3. generate_poster.py submits all three workflows over ComfyUI's HTTP API, renders the caption banner with ImageMagick, and composites the final poster.

No separate LLM server process is needed — the LLM runs natively inside ComfyUI's own model pipeline. OilrigSaveText (in __init__.py) is the one small custom node this depends on, used to retrieve the generated text back out over ComfyUI's API.

Prerequisites

  • ComfyUI, with these three model files already set up for use:
    • qwen_3_4b.safetensors (CLIP loader, type lumina2) — doubles as the LLM for both text-generation steps
    • z_image_turbo_bf16.safetensors (UNet / diffusion model)
    • ae.safetensors (VAE)
  • ImageMagick v6 or v7 installed and on PATH (supports both magick and legacy convert command execution)
  • Python 3 with Pillow and requests — see Setup below

Installation

  1. Clone this repo into your ComfyUI directory:
    cd ComfyUI/custom_nodes
    git clone https://github.com/FNGarvin/oilrig.git oilrig
  2. Restart ComfyUI to load the custom node pack. Inspect ComfyUI console logs to confirm oilrig has successfully initialized.
  3. The workflow templates prompt-gen.json, caption-gen.json, and t2i.json are packaged and ready to run inside the repo without further configuration.

Python Environment Setup

generate_poster.py is a standalone command-line script. While ComfyUI imports __init__.py as a custom node pack at boot, it never runs the script directly. To execute the CLI tool, use a Python environment that has Pillow and requests installed:

  • ComfyUI Virtual Environment: If configured, you can call ComfyUI's python executable directly:
    /path/to/ComfyUI/.venv/bin/python generate_poster.py "Your story text here"
  • ComfyUI Portable (Windows): If using the portable distribution, execute via the embedded Python folder:
    C:\path\to\ComfyUI_windows_portable\python_embeded\python.exe generate_poster.py "Your story text here"
  • Custom Environment: Alternatively, set up your own isolated environment:
    pip install -r requirements.txt
    (or with uv: uv venv && uv pip install -r requirements.txt)

Usage

Important

If your ComfyUI server listens on a custom host/port (other than the default http://127.0.0.1:8188), you can pass the appropriate target via the --comfy-url command-line option or by setting the COMFY_URL environment variable.

Command Execution Resulting Poster
Positional Story Argument:
Pass the news snippet directly as a string.

bash<br>python generate_poster.py "Arctic Oil Rig worker: $300,000/YEAR. Operates offshore rigs in minus 60 degree conditions on 30 day rotations. Fully tax free. Suicide rates on these rigs are the highest of any job."<br>

Optional Parameters:
- Use --seed N to pin the diffusion model generation seed.
- Use --comfy-url <url> to target distinct ComfyUI endpoints.
Demo Oil Rig Poster

File Input Option

You can also pull in long-form story or article contents dynamically from a text file:

python generate_poster.py --story-file mystory.txt

Each execution creates a dedicated storage folder under output/<timestamp>/ containing:

  • generated.png (Raw 1024x1024 image output from T2I)
  • banner.png (Generated layout containing the title block and subtext)
  • poster.jpg (Finished composite graphic)
  • run.log (Internal operation/parameters transcript text)

The automated script run_tests.py runs a series of mock test scenarios (including the headline-making test that inspired this project name) sequentially to verify end-to-end functionality.

Sample Gallery (from run_tests.py)

Here is a visual collection of the test cases executed by run_tests.py, displaying the source news text next to the generated final composition:

Case ID Input News Story / Bulletins Composited Output Poster
TEST 1 Baseline Oil Rig Bulletin

“Arctic Oil Rig worker: $300,000/YEAR. Operates offshore rigs in minus 60 degree conditions on 30 day rotations. Fully tax free. Suicide rates on these rigs are the highest of any job.”
Test 1 Result
TEST 2 High-Complexity Physics Bulletin

“BREAKING: Standard Model of Physics fundamentally upended as CERN detects stable tachyon emissions breaching causal thresholds at 1.4c. Theoretical teams scramble to rewrite baseline quantum electrodynamics models.”
Test 2 Result
TEST 3 Medium-Density Restoration Layout

“WANTED: Antique restoration specialist. Must possess verifiable experience handling mid-19th century clockwork automation systems, pneumatic assemblies, and leaf-spring governance layout. Inquire at Pier 4.”
Test 3 Result
TEST 4 Standard Conversational Public Notice

“LOST DOG: Fluffy, a 3-year-old Samoyed. Last seen near the reservoir on Tuesday evening wearing a bright reflective turquoise harness. Answers to his name or the sound of a rustling cheese wrapper. Reward offered.”
Test 4 Result
TEST 5 Extreme Environment Weather Alert

“WEATHER ALERT: Catastrophic high-pressure system locking over the central corridor. Record-breaking surface heat expected to touch 118 degrees with near-zero atmospheric visibility due to suspended dust particles.”
Test 5 Result
TEST 6 Unbothered Atlanta Nail Salon Robbery

“Crime fail: Customers at Atlanta nail salon ignore man trying to rob them. ... Police say he did swipe a cell phone from the woman who stood up, but it was later recovered. The suspect remains outstanding.”
Test 6 Result
TEST 7 Cardboard License Plate Felony

“BUFFALO, NY -- A New York woman who was reportedly driving around with a cardboard license plate wasn't fooling the cops. ... Schweickert was arrested and charged with possessing a forged instrument, which is a felony.”
Test 7 Result

Advanced Node Features

  • output_eval_gen.json contains a bonus evaluation workflow containing a vision-capable TextGenerate instance to score generated photos against their input prompt descriptions. This file is retained for future iteration or direct evaluation runs and is not executed by default in generate_poster.py.

License

This project is licensed under the terms of the MIT License. See LICENSE for details.

About

Oilrig: News Story → AI Poster Generator

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages