The FLUX.2 [max]: Object Swap workflow is designed to seamlessly replace objects within images while preserving the overall scene consistency and quality. At the heart of this workflow is the Flux2MaxImageNode, which leverages advanced image processing techniques to ensure precise object swaps. This workflow is particularly useful for tasks such as product photography and furniture swaps, where maintaining the integrity and aesthetics of the original image is crucial.
The process begins with the LoadImage node, which imports the image you wish to edit. The Flux2MaxImageNode then performs the object swap by identifying and replacing the target object with unmatched precision. The GetImageSize node ensures that the dimensions of the images are consistent throughout the process, while the BatchImagesNode allows for processing multiple images simultaneously, making it efficient for bulk tasks. Finally, the SaveImage node outputs the edited image, ready for use in various applications.
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.
GET https://comfy.org/workflows/download/7905fe6d550c.jsonFetching workflow JSON…
Run it from Python or TypeScript with the Comfy SDK. The same code targets Comfy Cloud or a ComfyUI you host yourself — only the base URL changes.
# Install (beta)
pip install comfy-sdk # Python
npm i @comfyorg/sdk # TypeScript
# Run "FLUX.2 [max]: Object Swap" (Python)
from comfy_sdk import Comfy
client = Comfy(api_key="comfyui-...")
# This workflow, exported in API format (see note below)
wf = client.workflows.from_file("api_bfl_flux2_max_sofa_swap_api.json")
asset = client.assets.from_file("input.png")
wf.set_input("10", "image", asset) # LoadImage
job = client.run(wf)
for output in job.get_outputs("6"): # SaveImage
output.to_file(output.name)The SDK takes a workflow in API format: open this workflow in ComfyUI and use File → Export Workflow (API). API access requires a Comfy Cloud plan with an API key. SDK docs · Get an API key
FAQ
![FLUX.2 [max]: Object Swap - After](https://comfy-hub-assets.comfy.org/templates/ce6308ef-c723-42de-9fb9-a91b88a27bd0.webp)
![FLUX.2 [max]: Object Swap - Before](https://comfy-hub-assets.comfy.org/templates/a644a267-23f9-4a55-b967-4a7c05bd9da8.png)














