The Stable Diffusion ComfyUI is a powerful GUI for AI image generation, but it’s also known for its limited documentation and steep learning curve for automatic1111 users.
By default, ComfyUI generated images will be dumped in the output folder with the meaningless filename ComfyUI_00001_.png with increasing numbers.
Setting custom filenames in ComfyUI workflow
- Right-click your Save Image node and select convert filename_prefix to widget.
- Add a Primitive node (Add Node > advanced > Primitive)
- Connect the Save Image node filename_prefix value to your Primitive node endopint.
- In this primitive node you can now set the output filename in the format specified in the manual, for example: %date:yyyy-MM-dd%/%date:hhmmss%_%KSampler.seed% to save files in a subfolder named with the current date.
Sample format strings
You can insert the image resolution to its filename as follows:
%date:yyyy-MM-dd%/%KSampler.seed%/%Empty Latent Image.width%x%Empty Latent Image.height%
You can also add a value from any node in the format %NodeName.node_value%.
Format like automatic1111 webui
Notice this is not the exact same format, because in auto1111 the filename begins with its generation number, ensuring they are sorted by generation. In Comfy, the generation number is inserted at the end and this cannot be changed.
Make sort by name also sort by generation number by prepending the time to the name:
By adding the current time (
%date:hhmmss%) to the beginning of the filename, sorting the folder by name will show the files in the same order they were created.
The content in this post is for general information purposes only. The information is provided by the author and/or external sources and while we endeavour to keep the information up to date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the post for any purpose. Some of the content and images used in this post may be copyrighted by their respective owners. The use of such materials is intended to be for educational and informational purposes only, and is not intended to infringe on the copyrights of any individuals or entities. If you believe that any content or images used here violate your copyright, please contact us and we will take appropriate measures to remove or attribute the material in question.