stable-diffusion-tensorflow icon indicating copy to clipboard operation
stable-diffusion-tensorflow copied to clipboard

Adding a more descriptive default output filename

Open hay opened this issue 3 years ago • 2 comments

Right now the default output filename is just output.png. This leads to two things that i think are undesirable:

  1. Whenever you run the script again and you didn't give a custom filename the old file will be overwritten
  2. It's impossible to retrieve the original prompt from the file

I've changed the default output filename to be a combination of a timestamp and a (sanitized) version of the prompt. So for example, when running the command:

python text2image.py --prompt="An astronaut riding a horse"

You'll now get the filename:

2022-09-28T22.53.20 - An astronaut riding a horse.png

Instead of just output.png. Of course you can still specify your own filename using the --output option.

hay avatar Sep 28 '22 21:09 hay

the problem that i had with such approach is that you easily pass 255 symbols maximum fullpath length :/ So I trim to only first 100 symbols

ju-popov avatar Sep 28 '22 21:09 ju-popov

@ju-popov good point. I've changed the PR to trim the 'prompt slug' to a maximum of 100 characters.

hay avatar Sep 29 '22 08:09 hay