ComfyUI Dual Image Transformer
Overview
The ComfyUI Dual Image Transformer node allows users to transform two input images into a single output image by leveraging ComfyUI workflows. This is particularly useful for scenarios such as image blending, comparison, or fusion where two source images are combined or processed together using a custom workflow defined in ComfyUI.
Typical use cases include:
- Blending two photos artistically.
- Comparing two images and generating a composite result.
- Creating fusion effects by combining features from both images.
- Any advanced image processing pipeline that requires two input images and outputs a transformed image.
Users provide a ComfyUI workflow JSON that must contain two LoadImage nodes, each corresponding to one of the input images. The node uploads both images to ComfyUI, updates the workflow with these images, triggers the image generation, waits for completion, and returns the generated image.
Properties
| Name | Meaning |
|---|---|
| Workflow JSON | The ComfyUI workflow in JSON format. Must include two LoadImage nodes. Defines how the two input images will be processed. |
| First Image Input Type | Specifies the input type for the first image. Options: URL, Base64, or Binary. |
| First Input Image | URL or base64 string of the first input image. Required if First Image Input Type is URL or Base64. |
| First Image Binary Property | Name of the binary property containing the first image data. Required if First Image Input Type is Binary. |
| Second Image Input Type | Specifies the input type for the second image. Options: URL, Base64, or Binary. |
| Second Input Image | URL or base64 string of the second input image. Required if Second Image Input Type is URL or Base64. |
| Second Image Binary Property | Name of the binary property containing the second image data. Required if Second Image Input Type is Binary. |
| First Image Node ID | The node ID in the ComfyUI workflow JSON corresponding to the first LoadImage node. Used to update the workflow with the uploaded first image. Default: "load_image_1". |
| Second Image Node ID | The node ID in the ComfyUI workflow JSON corresponding to the second LoadImage node. Used to update the workflow with the uploaded second image. Default: "load_image_2". |
| Timeout | Maximum time in minutes to wait for the image generation to complete before timing out. Default is 30 minutes. |
Output
The node outputs a single item containing:
json:
mimeType: MIME type of the generated image (e.g.,image/png,image/jpeg,image/webp).fileName: Filename of the generated image.data: Base64-encoded string of the generated image content.status: Status object returned from ComfyUI about the generation process.inputImages: Object listing the uploaded image names for the first and second inputs.
binary:
data: Binary representation of the generated image including metadata:fileName: Filename of the image.data: Base64-encoded image data.fileType: Always"image".fileSize: Approximate size in kilobytes.fileExtension: File extension (e.g.,png,jpg).mimeType: MIME type of the image.
This structure allows downstream nodes to access both the raw image data and metadata conveniently.
Dependencies
- Requires an active connection to a ComfyUI API endpoint.
- Needs an API key credential for authentication with ComfyUI.
- Uses HTTP requests to:
- Check system stats.
- Upload images.
- Submit the workflow prompt.
- Poll for generation status.
- Download the resulting image.
- Requires the ComfyUI workflow JSON to be valid and contain two
LoadImagenodes identified by user-specified node IDs. - The node expects input images either as URLs, base64 strings, or binary data within the n8n workflow.
Troubleshooting
Invalid workflow JSON: If the provided workflow JSON is malformed or not a valid object, the node throws an error. Ensure the JSON syntax is correct and the structure matches ComfyUI expectations.
Missing LoadImage nodes: Errors occur if the specified node IDs for the first or second image do not exist or are not
LoadImagenodes. Verify the node IDs match those in your workflow.Binary property not found: When using binary input types, if the specified binary property does not exist or contains non-image data, the node tries to find alternative image properties. If none are found, it throws an error. Make sure the binary property name is correct and contains valid image data.
Image download errors: If URLs for input images are invalid or inaccessible, the node will fail when trying to download them.
Timeouts: If image generation takes longer than the configured timeout (default 30 minutes), the node throws a timeout error. Increase the timeout if needed.
API connection issues: Failure to connect or authenticate with the ComfyUI API results in errors. Confirm the API URL and API key are correctly configured.
No image outputs found: If the workflow completes but no output images are detected, the node throws an error. Check your workflow's output nodes and ensure they produce images.
Links and References
- ComfyUI GitHub Repository β For understanding workflow structure and node types.
- n8n Documentation β General guidance on creating and using custom nodes.
- FormData npm package β Used internally for uploading images.
If you need help constructing the ComfyUI workflow JSON or troubleshooting specific errors, consulting the ComfyUI documentation and community forums is recommended.