ComfyUI > Nodes > zhangp365/ComfyUI-utils-nodes > Load Image with Switch

ComfyUI Node: Load Image with Switch

Class Name

LoadImageWithSwitch

Category
utils/image
Author
zhangp365 (Account age: 408days)
Extension
zhangp365/ComfyUI-utils-nodes
Latest Updated
2024-10-16
Github Stars
0.03K

How to Install zhangp365/ComfyUI-utils-nodes

Install this extension via the ComfyUI Manager by searching for zhangp365/ComfyUI-utils-nodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter zhangp365/ComfyUI-utils-nodes in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Load Image with Switch Description

Load images with switch for conditional loading control in workflows, enhancing flexibility and efficiency.

Load Image with Switch:

The LoadImageWithSwitch node is designed to load an image from a specified directory with an optional switch to enable or disable the loading process. This node is particularly useful when you need to conditionally load images based on certain criteria or user input. By incorporating a switch, it provides flexibility and control over the image loading process, allowing you to streamline workflows and avoid unnecessary operations when the loading is not required. This can be especially beneficial in complex image processing pipelines where conditional logic is necessary.

Load Image with Switch Input Parameters:

image

This parameter allows you to select the image file you wish to load. The available options are dynamically populated from the input directory, ensuring you can easily choose from existing files. The image_upload option is enabled, allowing you to upload an image directly if needed. This parameter is required for the node to function.

enabled

This optional boolean parameter controls whether the image loading process is enabled or disabled. When set to True (default), the node will proceed to load the specified image. If set to False, the node will skip the loading process and return None for the image and mask outputs. This parameter is useful for conditionally controlling the node's behavior based on external factors or user input. The labels for this parameter are "enabled" for True and "disabled" for False.

Load Image with Switch Output Parameters:

image

This output provides the loaded image if the enabled parameter is set to True. If enabled is False, this output will be None. The image output is essential for subsequent image processing tasks in your workflow.

mask

This output provides the mask associated with the loaded image if the enabled parameter is set to True. If enabled is False, this output will be None. The mask can be used for various image processing operations, such as segmentation or masking specific regions of the image.

enabled

This output returns the value of the enabled parameter, indicating whether the image loading process was executed or skipped. This can be useful for debugging or conditional logic in your workflow.

Load Image with Switch Usage Tips:

  • Use the enabled parameter to conditionally control the image loading process based on specific criteria or user input, optimizing your workflow by avoiding unnecessary operations.
  • Ensure the input directory is correctly set and contains the images you intend to load, as the image parameter options are dynamically populated from this directory.
  • Utilize the mask output for advanced image processing tasks, such as applying filters or transformations to specific regions of the image.

Load Image with Switch Common Errors and Solutions:

Invalid image file: <image>

  • Explanation: This error occurs when the specified image file does not exist in the input directory or is not a valid file.
  • Solution: Verify that the image file exists in the input directory and is correctly named. Ensure the input directory is correctly set and contains the desired image files.

No image selected

  • Explanation: This error occurs when no image file is selected in the image parameter.
  • Solution: Select an image file from the available options in the image parameter. If the desired image is not listed, ensure it is present in the input directory and refresh the node.

Image loading disabled

  • Explanation: This is not an error but an expected behavior when the enabled parameter is set to False.
  • Solution: If you intend to load an image, ensure the enabled parameter is set to True. If the loading is intentionally disabled, no action is needed.

Load Image with Switch Related Nodes

Go back to the extension to check out more related nodes.
zhangp365/ComfyUI-utils-nodes
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.