chrisgoringe / cg-controller

MIT License
29 stars 3 forks source link

[ feature ] Show in-progress preview in the `Image Preview` node #263

Open JorgeR81 opened 3 hours ago

JorgeR81 commented 3 hours ago

If an Image Preview node is added to the Controller, it would show the KSampler in-progress preview

This could be useful for people that want to build a whole GUI, like SwarmUI or InvokeAI. The "big picture area" can also show the in-progress preview.


There is a workaround for this, but it may be too complex for new users:

In Comfy UI, you can create a group node with: KSampler + Vae Decode + Image Preview. This way, the final image will show up in the same node as the in progress preview.

You can use the SamplerCustomAdvanced node, so that there are no other widgets. The you can add the group node the the Controller.

LukeG89 commented 3 hours ago

I think that the preview is only available on sampler nodes, you can associate a preview node to a ksampler latent preview (I guess).

Maybe a future workaroud would be through the "hide widgets" feature created by Pythongosssss.

chrisgoringe commented 3 hours ago

It's easy enough to catch the preview image - we already do it, in fact, in order to show the preview even if the KSampler node is minimised (minimised nodes don't get images for obvious reasons). So showing the preview wouldn't be technically hard.

Wondering what the UI would be like, though - a workflow might have multiple Image Preview nodes, (and/or multiple KSamplers) and it wouldn't make sense to show all KSampler in progress previews on all Image Previews.

It could be done if they are in the same group, perhaps, or if they are directly connected to each other in the workflow? Or would we need a way for the user to specify?

I'm leaning to the same group (and maybe only if there is exactly one preview and exactly one sampler)

JorgeR81 commented 2 hours ago

Wondering what the UI would be like, though - a workflow might have multiple Image Preview nodes, (and/or multiple KSamplers) and it wouldn't make sense to show all KSampler in progress previews on all Image Previews.

You would only show the in-progress preview, for the Image Preview nodes that are in the Controller. You would place the in-progress preview in the same exact area were the final image will show up, in the Image Preview. And once the generation is done, the in-progress preview would be replaced by the final image.

The main use case is a layout like this, with a single image preview. I want to see the preview, while the image is being generated, like in a traditional GUI.

If you can to this, you don't need to show the "in-progress preview" in the KSampler node.

p1b

LukeG89 commented 2 hours ago

or if they are directly connected to each other in the workflow?

I would choose this option, to associate the preview node to the KSampler that is generating the image.

JorgeR81 commented 2 hours ago

or if they are directly connected to each other in the workflow?

I would choose this option, to associate the preview node to the KSampler that is generating the image.

Yes, exactly.

JorgeR81 commented 1 hour ago

I'm using the rgthree progress bar it right now!

I don't think we need to replicate this functionality.

And ( unlike I suggested before ) we actually could use a progress bar for the controller.

It could be shown below the in progress preview !

chrisgoringe commented 1 hour ago

or if they are directly connected to each other in the workflow?

I would choose this option, to associate the preview node to the KSampler that is generating the image.

Actually, it's not directly connected, there is a VAE decode in between.

LukeG89 commented 1 hour ago

Actually, it's not directly connected, there is a VAE decode in between.

@chrisgoringe Damn it! 😆

It could be done if they are in the same group

But this way you will have both KSampler and Preview Image displaying the latent preview in the same window.

chrisgoringe commented 29 minutes ago

I think there are a few heuristics that could be used to link a preview node (or save image, for that matter) to a sampler.

One would be to follow the dataflow upstream - what node did the image come from? What node sent that node either an image or a latent? etc until you hit a sampler.

chrisgoringe commented 2 minutes ago

Um... I think I might have made this happen...