Skip to content

New Feature: "ZOOM ENHANCE" for the A111 WebUI. Automatically fix small details like faces and hands!

1 / 6
Not downloaded yet
Not downloaded yet
Not downloaded yet
Not downloaded yet
Not downloaded yet
Not downloaded yet

I'm pleased to announce the latest addition to the Unprompted extension: it's the [zoom_enhance] shortcode.

Named after the totally-not-fake technology from CSI, zoom_enhance allows you to automatically upscale small details within your image where Stable Diffusion tends to struggle. It is particularly good at fixing faces and hands in long-distance shots.

https://preview.redd.it/cv7d6ksx9fna1.png?width=1024&format=png&auto=webp&v=enabled&s=5da579960be762ca004b37d9a3002d9eee5a7f04

How does it work?

The [zoom_enhance] shortcode searches your image for specified target(s), crops out the matching regions and processes them through [img2img]. It then blends the result back into your original image. All of this happens behind-the-scenes without adding any unnecessary steps to your workflow. Just set it and forget it.

Features and Benefits

  • Great in both txt2img and img2img modes.
  • The shortcode is powered by the [txt2mask] implementation of clipseg, which means you can search for literally anything as a replacement target, and you get access to the full suite of [txt2mask] settings, such as "padding" and "negative_mask."
  • It's also pretty good at deepfakes. Set `mask="face"` and `replacement="another person's face"` and check out the results.
  • It applies a gaussian blur to the boundaries of the upscaled image which helps it blend seamlessly with the original.
  • It is equipped with Dynamic Denoising Strength which is based on a simple idea: the smaller your replacement target, the worse it probably looks. Think about it: when you generate a character who's far away from the camera, their face is often a complete mess. So, the shortcode will use a high denoising strength for small objects and a low strength for larger ones.
  • It is significantly faster than Hires. Fix and won't mess up the rest of your image.
  • Compatible with A1111's color correction setting, which you'll probably want to use to avoid issues related to over-saturation.
  • In many cases, it makes the "restore faces" option obsolete. Try the shortcode with and without "restore faces" and see for yourself.
  • Unlike "restore faces," [zoom_enhance] won't interfere with the style of your image. Face restoration is biased toward photography. With this shortcode, you can provide a subject like "illustration of walter white face" to avoid that problem.
  • Compatible with all models. You can even use `[set sd_model]` to change your checkpoint just during the upscale step.
  • Compatible with batch size and batch count.

More Examples

Don't take my word for it. Judge for yourself.

https://preview.redd.it/x72wng0jbfna1.png?width=1024&format=png&auto=webp&v=enabled&s=c5fdb6bfa107b166d56c42c5a1ad139705789234

https://preview.redd.it/nav8ff9kbfna1.png?width=1024&format=png&auto=webp&v=enabled&s=8770042f3eb55dcefcb8e6f28313d92ac9b02008

https://preview.redd.it/1vp60k7lbfna1.png?width=1024&format=png&auto=webp&v=enabled&s=be3f995dbab0577ec8b9779c2065817a1e69babf

https://preview.redd.it/abrlu62mbfna1.png?width=1024&format=png&auto=webp&v=enabled&s=d629aa4769cf2aea961999daca6bd8df654165be

How to Use

You can access the GUI through Unprompted » Wizard » Shortcodes » zoom_enhance:

https://preview.redd.it/b14fsrk7bfna1.png?width=1173&format=png&auto=webp&v=enabled&s=b4726649e0c3ad5068ee1f23e356454dfcb039ed

Or slam this into your prompt:

[after]{zoom_enhance}[/after]

It goes inside of an `[after]` block because it is supposed to execute after the generation of an image.

By default, it will look for `face` and replace it with an upscaled `face`. If you're making a specific person --such as Walter White--you should provide a more specific `replacement` value like so:

[after]{zoom_enhance replacement="walter white face"}[/after]

If you want to fix hands instead of a face, you can try something like this:

[after]{zoom_enhance mask="fingers" replacement="closeup hand" max_denoising_strength=0.9 precision=120}[/after]

Note: it's going to take some trial and error to find optimized settings for hands. Let me know if you find a config that works better than the one above.

You can place multiple `zoom_enhance` blocks back-to-back. Fixes multiple problem areas in one go.

Limitations

  • Because this shortcode calls an img2img task in an unusual manner, it may not be compatible with every extension. Try disabling your other extensions if you run into issues.
  • This shortcode has not yet been throughly battle-tested. Your bug reports are appreciated.

​

​

Bonus - send me some prompts in the comments and I'd be happy to run them through the extension to show you more before-after examples!

Edited 13 Mar 2023. We only hold this version.

695 points173 comments
Open on Reddit
About this post
Posted
Archived
Edited
Score
695 · 96% up
Kind
Gallery · 6 files
ID
11pyiro

Author

23
posts
95
comments
31
media
View profile
No comments archived yet. Reddit counts 173.

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.