Haoming02 / sd-webui-mosaic-outpaint

An Extension for Automatic1111 Webui that trivializes outpainting
MIT License
84 stars 1 forks source link

Make mosaic from existing picture #2

Closed MoreColors123 closed 7 months ago

MoreColors123 commented 8 months ago

I get some really good results and played around with using the mosaic effect in photoshop as well. It works too, After that i thought It would be a great enhancement for the plugin (and for people without photoshop) if you could just do the mosaic effect on an existing photo in the plugin as well. - but without sizing up the picture in any direction. Maybe by defining a percentage of the height or width that should be mosaiced.

Edit: what if you made the slider "expand" accept a value of zero?

Haoming02 commented 8 months ago

On Hold

I'll probably add this in a separate block instead

Haoming02 commented 8 months ago

Please check out the dev branch

I added it as a Script. When doing img2img or Inpaint, select the script from the Dropdown to activate it.

MoreColors123 commented 7 months ago

I'm sorry i just couldn't find out how to do that dev branch pull properly. Can someone chime in?

Haoming02 commented 7 months ago

The easiesy way would be:

  1. Uninstall this Extension (inside your extensions folder, remove the sd-webui-mosaic-outpaint folder)
  2. Launch the Webui
  3. Go to the Extensions tab
  4. Go to Install with URL
  5. Enter the URL of this repo
  6. Enter dev in the field for Branch
  7. Install as usual
MoreColors123 commented 7 months ago

OK thanks! Didn't think of that...

So, I got some pretty good fast results but didn't test it enough yet to be sure if the result is really different from actual inpainting. It seems that the inpainted part is more true to the colors of the original image, which should be the case I think.

The masked area obviously becomes a rectangular mosaiced block (and how else should it be of course). What inpaint settings do you think are best? I want to play around more with the Denoise value. Here I used 20 steps, CFG 7 and very high denoising (0.97 here), it might benefit from 0.75 or something in that ball park. And I set it to Original, not Fill:

Here is the original picture, which I loaded in Inpaint, then masked the top part (mountains) with the mask tool: 00002-3591478570 this is the resulting image: 00014-1092213053

this is the resulting mask: tmplf_o8p71

this is the mosaiced version: tmpi4qh7ila

MoreColors123 commented 7 months ago

After more testing I definitely think denoising between 0.7 and 0.75 is best. you get different objects with similar colors on the masked parts. WIth lower denoising you see low quality results or even the mosaic is left in place. With higher desnoising you get totally different objects.

MoreColors123 commented 7 months ago

works fine! not sure about the use case yet, but it does it's job! denoising level 0.75

original image 00008-373693443

resulting image 00053-30715071

mosaic tmpy_yd9ks3

resulting mask tmp_ucbc3t4

CCpt5 commented 7 months ago

I noticed this was added in an update tonight (thanks!).

I'm not seeing a script for it though in either A1111 or A1111 (Forge). I assume it should be an option in the script pull down menu on the IMG2IMG tab? Thanks for any info @Haoming02 !

Re:

"## Mosaic Inpaint Now also comes with a Script for generating mosaic patterns within Inpaint masks. (Can also be used in img2img to convert the entire image into mosaic patterns before the generation.)"

--

I am using the latest 1.8rc of A1111 but mostly the Forge fork which is also mirroring the latest development branch.

System info:

Details

[sysinfo-2024-02-29-06-24.json](https://github.com/Haoming02/sd-webui-mosaic-outpaint/files/14443721/sysinfo-2024-02-29-06-24.json)

dfdsf

Haoming02 commented 7 months ago

In your sysinfo, your seem to be using an outdated version of this Extension.

Did you click Check for updates in the Extensions tab?

If so, and it doesn't show a newer commit... this could be a problem...

I did some shenanigans and renamed the branches before. Does the Webui lose track of the latest version...?

CCpt5 commented 7 months ago

I did pull the update via the app and it does show I'm on the latest (just re-checked / attached).

I'll try completely deleting the extension (folder) and installing it again (URL into A1111). 465465416

Haoming02 commented 7 months ago

Oh well I'll need to test if renaming master back to main can fix this...

CCpt5 commented 7 months ago

Deleting the folder and reinstalling the extension worked - I see it in script now.

Before I'd uploaded it using the in app button, so I guess that doesn't work probably perhaps due to the branch renaming.

Thanks for implementing this!

CCpt5 commented 7 months ago

Is it possible to somehow use this script to batch expand vertical images (IE: 1024x1280) to square (IE: 1280x1280)?

I'm guessing not, but this tool does a great just of outpaining and my main usecase it "fixing" images I generated in poster/vertical resolutions so I can use them for training. It'd be amazing if there was a way to use the IMG2IMG batch feature w/ a general mosaic setting/no-prompt to just do a rough conversion to a different resolution. I tried setting the "resize mode" to resize and fill, but seems like that overrides the script.

Figure it's a longshot, but wanted to check....

Haoming02 commented 7 months ago

Hmm. I can probably add another text field for batch from folder.

CCpt5 commented 7 months ago

Hmm. I can probably add another text field for batch from folder.

That'd be great if you could - absolutely no rush, but if you get a free moment sometime.

Thanks again for the extension!!