TK 图像选择:
The TK Image Select node is a versatile tool designed to streamline the process of selecting images from multiple inputs. It allows you to connect up to eight different image sources and choose one based on various routing modes. This node is particularly beneficial for scenarios where you need to dynamically switch between different image sources without manually reconfiguring connections. By offering modes such as priority-based selection, specific index selection, random choice, seed-stable selection, and polling, it provides flexibility and control over the image selection process. This functionality is especially useful in creative workflows where the source of images might change frequently, such as in digital art galleries or custom image sources. The node ensures that at least one valid image input is always selected, skipping any unconnected inputs automatically.
TK 图像选择 Input Parameters:
mode
The mode parameter determines the method used to select an image from the available inputs. Options include "优先顺序" (priority order), "指定索引" (specific index), "随机" (random), "Seed 稳定" (seed-stable), and "轮询" (polling). Each mode offers a different approach to image selection, allowing you to tailor the node's behavior to your specific needs. The default mode is "优先顺序".
priority
The priority parameter specifies the preferred image input when using the priority order mode. It allows you to set a primary image source, with fallback options in case the primary source is unavailable. The default value is "image1".
index
The index parameter is used in the specific index mode to select a particular image input by its index number. This parameter ensures precise control over which image is selected, with a minimum value of 1 and a maximum of 8.
seed
The seed parameter is used in the seed-stable mode to ensure consistent image selection across different executions. By providing a specific integer seed, you can achieve reproducible results. The seed value ranges from -2^63 to 2^63
- 1, with a default of 0.
image1 to image8
These parameters represent the potential image inputs to the node. You can connect any number of image sources, from 2 to 8, and the node will automatically skip any unconnected inputs. Each input is labeled as "image1" through "image8".
TK 图像选择 Output Parameters:
image
The image output provides the selected image(s) as a list. This ensures compatibility with workflows that expect a list of images, even if only a single image is selected.
source_index
The source_index output is an integer indicating the index number of the selected image source, ranging from 1 to 8. This helps identify which input was chosen.
source_name
The source_name output is a string that specifies the name of the selected image input, such as "image1" or "image2". This provides a clear reference to the source of the selected image.
TK 图像选择 Usage Tips:
- Use the "优先顺序" mode to automatically select the first available image input, which is useful for fallback scenarios.
- When you need consistent results across different runs, opt for the "Seed 稳定" mode and set a specific seed value.
- For dynamic and varied image selection, the "随机" mode can introduce variability by randomly choosing from available inputs.
- If you want to cycle through images in a round-robin fashion, the "轮询" mode is ideal, especially when combined with the IS_CHANGED function to ensure updates.
TK 图像选择 Common Errors and Solutions:
TK 图像选择:所有输入图像(image1~image8)均为空,请至少连接一路图像输入
- Explanation: This error occurs when none of the image inputs are connected, leaving the node without any valid image to select.
- Solution: Ensure that at least one image input is connected to the node.
TK 图像选择:指定索引 <index> 对应 <label> 未连接(可用:<present>)
- Explanation: This error arises when the specific index mode is used, but the selected index does not have a connected image input.
- Solution: Connect an image to the specified index or choose a different index that has a connected image.
TK 图像选择:输入 <label> 的图像列表为空
- Explanation: This error indicates that the selected image input is connected but contains an empty list of images.
- Solution: Verify that the connected image input contains valid images and is not empty.
