Relight and Environment Merge

This workflow relights an illustrated character to match a new background plate and merges them into a cohesive keyframe. The heavy lifting is packaged inside a Subgraph node (type ID: 9e3c3756-d15f-4361-8e99-c35673036e68), so you only interact with a few clear inputs and controls. You provide a character image and an environment image via LoadImage nodes, drive the look with prompt text (see the in-graph Note/MarkdownNote), and export results with SaveImage.

Technically, the Subgraph stacks an illustration LoRA for style cohesion with a relight LoRA that adapts shading and color to the environment. The subgraph handles conditioning, relight guidance, and foreground/background compositing, exposing simple strength sliders and merge options so you can balance “style” versus “lighting” without touching the internals. Notes in the graph include Chinese prompt text—keep those characters intact and append your own edit instructions after them to refine light direction, mood, color temperature, or rim light accents. For local users, ensure any referenced text encoder files (e.g., qwen_2.5_vl_7b_fp8_scaled.safetensors) are available so the subgraph can encode prompts as intended.

API

Use this workflow from code

Every Comfy workflow is a JSON graph. The payload below is this workflow, exactly as ComfyUI runs it — fetch it from the URL, keep it in version control, or load it in ComfyUI and run it node by node.

50199f76fe74.json
Fetching workflow JSON…

Run it from TypeScript or Python with the Comfy SDK. The same code targets Comfy Cloud or a ComfyUI you host yourself — only the base URL changes.

// Install (beta)
npm i @comfyorg/sdk

// Run this workflow (TypeScript)
import { Comfy } from "@comfyorg/sdk";

const client = new Comfy({ apiKey: "comfyui-..." });
const wf = await client.workflows.fromFile("workflow_api.json");
const job = await client.run(wf);
await job.getOutputs("<output-node-id>")[0].toFile("output.png");

The SDK takes a workflow in API format: open this workflow in ComfyUI and use File → Export Workflow (API).

Comfy Cloud API access requires a plan with an API key.

FAQ

Frequently Asked Questions

View all workflows
Showing 30 of 30 templates