Wildcard implementation that can be reproduced with workflows.
ComfyUI has an amazing feature that saves the workflow to reproduce an image in the image itself. In theory, you can import the workflow and reproduce the exact image. Unfortunately, this does not work with wildcards. The goal of this node is to implement wildcard support using a seed to stabilize the output to allow greater reproducibility.
Wildcards are supported via brackets and pipes.
Example:
A painting of a {boat|fish} in the {sea|lake}
The first pair of words will randomly select boat
or fish
, and the second will either be sea
or lake
.
The following is a list of possible random output using the above prompt:
Note: Everything including the brackets are replaced with the final word.
Include spaces around your {}
to prevent words from running together, or use it
to modify words.
Ex: {cat|dog}fish
outputs catfish
or dogfish
.
The node requires three inputs
The node has one output
An additional node is included that disabled the default dynamicPrompt behavior of multiline inputs.
Below are my opinions and as such will probably not be changed.
Many other implementations combine this feature with the CLIP node. I chose not to do this to keep the wildcard code and CLIP implementation separate and more re-usable.
Probably won't be implemented. Files are external to the workflow, so there is no guarantee that (1) the file exists on another system and (2) the file content has not been modified. File wildcards are not an appropriate approach if you are looking to create repeatable output.