Skip to content
Help Build a Better ComfyUI Knowledge Base Become a Patron

ComfyUI LBM Relighting Workflow - Complete Step-by-Step Tutorial for Fast Image Relighting

LBM Relighting Introduction

LBM (Latent Bridge Matching) is a deep learning-based image relighting technology developed by the Jasper AI team and first introduced in the paper LBM: Latent Bridge Matching for Fast Image-to-Image Translation. This technology specifically addresses a long-standing challenge in computer vision: how to naturally blend the lighting effects of foreground objects with new background environments.

LBM Relighting Effect Demonstration

Technical Background and Innovation

Traditional image compositing often faces lighting inconsistency issues. When we move an object from one scene to another, the original lighting conditions usually don’t match the new environment, resulting in unnatural-looking composites. LBM technology solves this problem through the following innovations:

  1. Latent Space Bridge Matching: Performs bridge matching in latent space for efficient image-to-image translation
  2. Environment-Aware Lighting: Can understand lighting characteristics of background environments and apply them to foreground objects
  3. Fast Inference: Compared to traditional methods, LBM requires very few inference steps to produce high-quality results
  4. Detail Preservation: Perfectly maintains original object details and textures while changing lighting

You can experience LBM Relighting effects through the following online demo: https://huggingface.co/spaces/jasperai/LBM_relighting

ComfyUI LBM Relighting Workflow Step-by-Step Tutorial

1. LBM Relighting Workflow and Material Downloads

Download the image below and drag it into ComfyUI to load the corresponding workflow. The workflow already includes corresponding model information. If a popup appears, click download, or manually download models according to the model download information in the workflow.

LBM Relighting Workflow

For embedded model links, if you’re using the Desktop version, it will automatically download and rename. Other versions need to manually rename the file to LBM_relighting.safetensors

JSON format workflow download

Download the images below as input images:

ComfyUI LBM Relighting Workflow Background Image

ComfyUI LBM Relighting Workflow Subject Image

2. Manual Model Download

Please download the model.safetensors file, rename it to LBM_relighting.safetensors, and save it to the ComfyUI/models/diffusion_models/ folder

3. Install Required Custom Nodes

To use LBM Relighting in ComfyUI, you need to install the following custom nodes. You can use ComfyUI Manager’s missing nodes feature to install, or refer to the ComfyUI Custom Nodes Installation Tutorial for manual installation.

Main Nodes

Auxiliary Nodes

4. Follow Step Guide to Complete Workflow Execution

ComfyUI LBM Relighting Workflow Step Guide

  1. Ensure the Load LBM Model node loads the renamed LBM_relighting.safetensors model
  2. Upload background image in the Load Image node in the Upload Background group
  3. Upload subject image in the Load Image node in the Upload Subject group
  4. (Optional) Adjust composition position in the ImageCompositeMasked node’s corresponding XY position
  5. Click the Run button, or use the shortcut Ctrl(Cmd) + Enter to execute image generation
  6. This workflow doesn’t use Save Image. You can view results in the Preview Image node and see comparison effects in the Image Comparer(rgthree) node

5. Workflow Additional Notes

  • This workflow is slightly adjusted based on the original custom node workflow, mainly scaling the subject image and adjusting it to fit the background image size
  • You can modify the Get Image Size node’s Image input to the Subject node, allowing the background to adjust to the subject’s image size
  • To adjust image combination position, modify the XY position in the ImageCompositeMasked node
  • To adjust subject size, disconnect the size input connections and separately adjust Width and Height in the Resize Image node
  • You can add Refine workflows after this workflow to fix image details