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

[Feature Request]: Save interstitial image during generation

Open shadowlocked opened this issue 3 years ago • 15 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What would your feature do ?

Oftentimes the 'developing' images are better than the final image, or at least are more suitable fodder for further development than the final image. It would be great in there was a Save button that could save the currently-visualized image to the default generation folder.

Proposed workflow

  1. You start generating the image, either txt2img or Img2Img, whatever
  2. Visualizations roll by as the noise evolves
  3. You see a really great mid-development image you'd like to save (i.e., without saving the entire roll of interstitial images)
  4. You press the dedicated Save button that appears during the corner of the results window during generation.

Additional information

No response

shadowlocked avatar Mar 10 '23 06:03 shadowlocked

There is an extension for this that works somewhat well but you might need to adjust it in terms of output folder/naming if you want it to be consistent with your preferred way to save files. With the caveat of it actually saving 'all' or every 'n' number or 'starting from n' number. So not exactly what you propose. I do however find it a bit 'too hands-on' to sit and stare at a PC when it generates images when it can do it on its own and results can be previewed after.

sd_save_intermediate_images https://github.com/AlUlkesh/sd_save_intermediate_images.git

You need to, however, disable preview and or find options in settings that disable approximation images for preview. When I had preview enabled, saved images were 'thumbnails' of horrible quality, while with that setting off I was able to get full images of good quality.

This however should be an inbuild option into the automatic1111 as playing with plugins and modifying them to work as needed is a hassle.

iluzek avatar Mar 10 '23 15:03 iluzek

When I had preview enabled, saved images were 'thumbnails' of horrible quality

Default for previews is 1/4 resolution. Simply change it in options to full.

vladmandic avatar Mar 10 '23 23:03 vladmandic

I installed that plugin, but have not had a good experience with it.

shadowlocked avatar Mar 11 '23 07:03 shadowlocked

I would love to be able to save images from the last N generation steps, this would save us lots of time, especially with samplers that produce good enough results with fewer iterations

Zueuk avatar Mar 11 '23 12:03 Zueuk

if you want, you can try out https://github.com/vladmandic/sd-extension-steps-animation, simply don't save video, set intermediate images to be left on disk and skip n initial steps.

vladmandic avatar Mar 11 '23 12:03 vladmandic

if you want, you can try out https://github.com/vladmandic/sd-extension-steps-animation, simply don't save video, set intermediate images to be left on disk and skip n initial steps.

Not exactly what I'm looking for, the images saved from there are:

  • JPEG
  • named like 00000.jpg
  • don't have any embedded PNG info

which might not be such a problem if I had a 4090 and/or lots of time to re-generate the step(s) I liked every time... but I don't

Zueuk avatar Mar 11 '23 12:03 Zueuk

if there is a demand, all those requests are easily addressable.

vladmandic avatar Mar 11 '23 12:03 vladmandic

I don't think that saving the entire roll is worthwhile, as the early ones will be noisy nonsense. I still think one should be able to rip out a transient stage with a save button, to the default images folder. Though it's not simple, I'm sure, it's simpler than figuring out how to handle complete denoising image sequences, in terms of naming, etc.

shadowlocked avatar Mar 11 '23 17:03 shadowlocked

@shadowlocked like i said, extension i've mentioned already has a configurable skip initial steps option. on your proposal, there are two major issues:

  • displaying preview on each step in ui slows down actual generation a lot.
  • if you have a fast gpu, steps go really fast (rtx4090 will do up to ~45 per second) and there is no way to "capture" it at the right moment.

vladmandic avatar Mar 11 '23 17:03 vladmandic

Thanks for that. Eventually I will install FFMPEG (which the mentioned extension needs).

shadowlocked avatar Mar 11 '23 18:03 shadowlocked

It only needs it to create videos, shouldn't be needed just to get intermediary images. I'll check if check for ffmpeg is too early.

vladmandic avatar Mar 11 '23 18:03 vladmandic

Can confirm, it only complains about no ffmpeg if "Create animation" is checked

Zueuk avatar Mar 11 '23 19:03 Zueuk

@Zueuk and anyone else interested.

Just to address my first mention about 'sd_save_intermediate_images https://github.com/AlUlkesh/sd_save_intermediate_images.git'.

You can in fact save 'good quality' images with settings as I initially mentioned, just didn't remember the exact setting in SD settings page. You can save them as png and they do include all the png info. You can also save get additional .txt file (not sure if that was the SD setting or default in the extension).

And while it doesn't have the option to save the previewed image, it does have the option to set saving from 0 or a specified step and can skip every n specified step or save every single one.

The only issue I've found in regards to that plugin and step count is that if your specified step count in the plugin is lower than the actual step count within SD, it then doesn't save anything. It was a bit of a pain for me because I struggled with another bug where my png info wasn't saved in the final files so I used this plugin instead.

Another useful feature that this plugin DOESN'T have is saving 'last n' steps. this could be useful if the plugin knew how many steps are 'predicted/set by sd', but sadly that is not implemented.

I found this plugin useful with bug I experienced but I think most importantly it can help figure out actually needed steps for your generations so you don't waste 2-10 min when 30 sec is enough (depending on hardware/settings).

iluzek avatar Mar 12 '23 15:03 iluzek

Another useful feature that this plugin DOESN'T have is saving 'last n' steps. this could be useful if the plugin knew how many steps are 'predicted/set by sd', but sadly that is not implemented.

requested steps vs executed steps is not the same. its easy to know how many steps are requested, but quite a few samplers have early exit when they consider sampling as "done". so there's no way to do it cleanly (you could save all and then delete everything except last n at the end, but i don't like that)

btw, i've updated https://github.com/vladmandic/sd-extension-steps-animation with feedback:

  • use user-selected image format
  • use real file names
  • detect and warn on preview resolution
  • save metadata info in images

vladmandic avatar Mar 13 '23 14:03 vladmandic

requested steps vs executed steps is not the same

So when you interrupt image generation and it turns out good, there is no easy way to reproduce it because no idea on which exact step it was interrupted 😕 Just another reason to use your extension

Zueuk avatar Mar 18 '23 10:03 Zueuk