ComfyUI Image to Image icon

ComfyUI Image to Image

Transform images using ComfyUI workflow

Overview

This node transforms images using a ComfyUI workflow. It accepts an input image in various formats (URL, base64 string, or binary data), uploads it to the ComfyUI server, runs a user-defined image processing workflow on it, and returns the transformed image.

Common scenarios include:

  • Automating image enhancement or style transfer workflows.
  • Batch processing images with custom AI-driven transformations.
  • Integrating ComfyUI-based image generation into larger automation pipelines.

For example, a user can provide a JSON workflow describing a sequence of image filters and pass an image URL; the node will process the image accordingly and output the transformed result.

Properties

Name Meaning
Workflow JSON The ComfyUI workflow definition in JSON format that describes the image transformation steps.
Input Type The format of the input image. Options: URL (image fetched from a web address), Base64 (base64-encoded image string), or Binary (image data from a binary property).
Input Image The input image data as a URL or base64 string. Required if Input Type is url or base64.
Binary Property The name of the binary property containing the image data when Input Type is binary.
Timeout Maximum time in minutes to wait for the image generation to complete before timing out.

Output

The node outputs the transformed image in both JSON and binary forms:

  • json: Contains metadata about the output image including:

    • mimeType: MIME type of the image (e.g., image/png, image/jpeg).
    • fileName: The filename of the generated image.
    • data: Base64-encoded image data.
    • status: Status object returned by ComfyUI after processing.
  • binary: Contains the actual image file data with properties:

    • fileName: Filename of the image.
    • data: Base64-encoded image content.
    • fileType: Always "image".
    • fileSize: Size of the image file in kilobytes.
    • fileExtension: File extension such as png, jpg, jpeg, or webp.
    • mimeType: MIME type matching the image format.

This allows downstream nodes to easily consume the processed image either as raw binary or as encoded data.

Dependencies

  • Requires access to a ComfyUI API endpoint with a valid API URL and an API key credential for authentication.
  • The node makes HTTP requests to the ComfyUI server to upload images, submit workflows, and poll for results.
  • Requires n8n credentials configured with the ComfyUI API URL and API key.
  • Uses the form-data package internally to upload images.

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 structure matches ComfyUI expectations.
  • No LoadImage node found: The workflow must contain a LoadImage node with an image input. Without this, the node cannot inject the uploaded image.
  • Binary property not found or invalid: When using binary input, if the specified binary property does not exist or is not an image, the node tries to find an alternative image property. If none is found, it errors out.
  • Image generation timeout: If the ComfyUI server does not complete image generation within the specified timeout, the node throws a timeout error.
  • API connection issues: Errors connecting to the ComfyUI API or missing/invalid API keys will cause failures. Verify API URL and credentials.
  • Image file not found: If the generated image file is missing on the server, an error is thrown.

To resolve these issues:

  • Validate your workflow JSON carefully.
  • Confirm the input image data and binary property names.
  • Check API credentials and network connectivity.
  • Increase the timeout if processing takes longer.

Links and References

Discussion