Comfy-Org / Comfy-Org/ComfyUI

Save File Formatting %date% evaluation in Batch Queue > 1 not using time of file creation

Open
#1,176 6 comments 7 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

If you use the Save File Formatting feature in the native ComfyUI Save Image node with a syntax like `%date:yyyyMMddhhmmss%` and in a Queue with a Batch Count > 1, all filenames will receive the same populated `%date%` variable.

## Example
In a queue with a batch count of > 1, all files will be named with the populated `%date%` variable of the first file indepenent of when the image file was created or the job in the queue ran.
```
myfile-20230809195712_00001_
myfile-20230809195712_00002_
myfile-20230809195712_00003_
myfile-20230809195712_00004_
...
```

I suppose `%date%` is evaluated when all jobs in a queue are created. So I'm not sure if this is a limitation of how jobs are processed in general.

Would it be possible to have the Save File Formatting variables, especially `%date%`, be populated either on the start of the current image generation in the queue or on file creation?

## Additional issues manifesting because of this
If you move or delete an image while a Queue job with a Batch count > 1 is running, the next filename that will be created fills that position.

It continuous incrementing once all missing positions in the current *numbering* have been filled. Because of this the files will no longer be sorted chronologically as they were created.

## Example

List of images in the `/output/` directory
```
myfile-20230809195712_00001_
myfile-20230809195712_00002_
myfile-20230809195712_00003_
myfile-20230809195712_00004_
...
```
If you now delete or move the file `myfile-20230809195712_00003_`, the next generated image will fill its place with the same name.
Now you have 2 images with the filename.

Solving this would make organizing and sorting of image files more robust.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.