FahimF / sd-gui

Clean and simple Stable Diffusion GUI for macOS, Windows, and Linux
MIT License
230 stars 17 forks source link

[Feature request] Image upscaling #6

Open dylancl opened 1 year ago

dylancl commented 1 year ago

Firstly, thanks for the great tool. It serves all my needs for an Apple Silicon optimized GUI which is great 😄 .

A feature that I'm sorely missing though is the ability to upscale images (using ESRGAN model). I'm a TypeScript developer and not the best with Python, so if it's possible for you to outline in some detail what needs to happen to make this available, I'll gladly open a PR to try and add this feature myself.

Thanks again!

FahimF commented 1 year ago

This is something that I wanted to look into at some point — just got bogged down with all the changes coming in for SD and just testing out other stuff 😄

For the moment, what I'm doing is using the Real-ESRGAN binary and running it via the CLI when I need to upscale something. But this could probably be done two ways:

  1. The easy way where you just have a button in the GUI saying "Upscale" and when you select it it will upscale the current batch (or a single image) by passing it's path to the binary file for Real-ESRGAN. Of course, you'd also have to have a config (or UI) setting for where the Real-ESRGAN binary is on your hard drive.
  2. The slightly more effort intensive way would be to be integrate the ESRGAN code into the GUI code to do the upscaling via code and not the binary. That would take a bit more effort and I'd need to look at ESRGAN code to see how it would work.

Let me know if the easier routes don't work or look problematic to you and I'll see if I can get the upscaling prioritised this weekend 😄

I've got a new GUI working but it's not Python code and so there's questions about getting it working on all platforms (or rather, being able to test on all platforms ...) So been neglecting the current GUI and adding features to it.

dylancl commented 1 year ago

Thanks for the detailed response - it sounds like the first option is the "easiest" (it's never really easy is it 😂 ) so I'll give that a shot some time this week - I'm not sure if it'd be worth opening a PR for it if I get it working since it'd probably be terrible code (remember, not a Python dev 😄 ).

Regarding the new GUI, if it reaches a point where you're looking for testers I'll gladly help.

Thanks again!

FahimF commented 1 year ago

Don't worry about how good or bad the code is, just do it — you always learn from the experience 😄 On the other hand, if you'd rather not code at all, then let me know and I'll see if I can get something done this weekend. Or, I can set up a quick script for you to run via the terminal that would upscale specific images ... but I think you want all images you generate to be upscaled, right?

The new GUI probably would have been at least partially ready for testing this weekend but I started a new project and so not sure how far it'll get. But thank you for the kind offer to test. Will let you know when it's ready.