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.
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:
- Latent Space Bridge Matching: Performs bridge matching in latent space for efficient image-to-image translation
- Environment-Aware Lighting: Can understand lighting characteristics of background environments and apply them to foreground objects
- Fast Inference: Compared to traditional methods, LBM requires very few inference steps to produce high-quality results
- 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.
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:
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
- ComfyUI-LBMWrapper - Core wrapper for LBM model
Auxiliary Nodes
- ComfyUI-KJNodes - Provides additional image processing like size adjustment
- ComfyUI_essentials - Background removal nodes
- (Optional) rgthree-comfy - Compare node provides before/after comparison functionality
4. Follow Step Guide to Complete Workflow Execution
- Ensure the
Load LBM Model
node loads the renamedLBM_relighting.safetensors
model - Upload background image in the
Load Image
node in the Upload Background group - Upload subject image in the
Load Image
node in the Upload Subject group - (Optional) Adjust composition position in the
ImageCompositeMasked
node’s corresponding XY position - Click the
Run
button, or use the shortcutCtrl(Cmd) + Enter
to execute image generation - This workflow doesn’t use
Save Image
. You can view results in thePreview Image
node and see comparison effects in theImage 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
andHeight
in theResize Image
node - You can add Refine workflows after this workflow to fix image details
Other LBM Relighting Related Links
- LBM Relighting Official GitHub Repository
- LBM Relighting Model Page
- LBM Relighting Online Demo
- LBM Relighting Paper Link