ComfyUI Image Transformer icon

ComfyUI Image Transformer

πŸ–ΌοΈ Transform and enhance images using ComfyUI workflows (img2img, inpainting, style transfer)

Overview

This node integrates with ComfyUI to transform and enhance images using customizable workflows defined in JSON format. It supports image-to-image transformations such as img2img, inpainting, and style transfer by uploading an input image, running it through a specified ComfyUI workflow, and returning the processed image.

Common scenarios include:

  • Enhancing or modifying images based on AI-driven workflows.
  • Applying artistic styles or effects to existing images.
  • Automating image editing tasks within an n8n workflow.

Practical example:

  • You provide a base64-encoded photo and a ComfyUI workflow that applies a style transfer effect. The node uploads the image, runs the workflow, and outputs the stylized image for further use or storage.

Properties

Name Meaning
Workflow JSON The ComfyUI workflow definition in JSON format describing the image processing pipeline.
Input Type Specifies how the input image is provided: URL, Base64 string, or Binary data from input.
Input Image The URL or base64-encoded string of the input image (required if Input Type is URL or Base64).
Binary Property The name of the binary property containing the image data (required if Input Type is Binary).
Image Node ID The node ID within the ComfyUI workflow that loads the input image (usually a LoadImage node).
Timeout Maximum time in minutes to wait for the image generation process before timing out.

Output

The node outputs an array of items, each containing:

  • json object with:

    • mimeType: MIME type of the output image (e.g., image/png, image/jpeg).
    • fileName: Filename of the generated image.
    • data: Base64-encoded string of the image data.
    • status: Status information returned from ComfyUI about the generation process.
  • binary object with:

    • data: The image file encoded in base64 along with metadata:
      • fileName: Filename of the image.
      • fileType: Always "image".
      • fileSize: Approximate size in kilobytes.
      • fileExtension: File extension (e.g., png, jpg).
      • mimeType: MIME type of the image.

This structure allows easy downstream usage of the generated image either as binary data or JSON metadata.

Dependencies

  • Requires access to a ComfyUI API endpoint with a valid API URL and an API key credential for authentication.
  • The node uses HTTP requests to communicate with the ComfyUI server, including endpoints for system stats, image upload, prompt submission, and result retrieval.
  • Requires n8n helper functions for HTTP requests and binary data handling.

Troubleshooting

  • Invalid workflow JSON: If the workflow JSON is malformed or not a valid object, the node throws an error. Ensure the JSON syntax is correct and the workflow structure matches ComfyUI expectations.
  • LoadImage node not found: The specified Image Node ID must exist in the workflow and be of the correct type. Verify the node ID matches a LoadImage node.
  • Binary property missing or invalid: When using binary input, the specified binary property must exist and contain image data. If not found, the node attempts to find an alternative image property; otherwise, it errors out.
  • Unsupported media type: Only image MIME types are supported for input. Non-image binary data will cause an error.
  • Timeouts: If image generation takes longer than the configured timeout (default 30 minutes), the node throws a timeout error.
  • API connection issues: Failure to connect or authenticate with the ComfyUI API results in errors. Check API URL, credentials, and network connectivity.
  • No image outputs found: If the workflow completes but no output images are returned, the node errors out. Confirm the workflow produces image outputs.

Links and References

Discussion