Please check out the new and improved Vectorscope CC!
This repo will no longer receive updates...
This is an Extension for the Automatic1111 Webui, which tries to enhance the img2img upscale quality.
I came up with a convoluted way to slightly enhances the img2img process
by artificially adding in some noise to retain some of the "texture" during upscale,
and offsetting said noise based on the brightness of the input image, to further increase the contrast.1
On top of that, since this process happens before the Stable Diffusion pipeline,
this can take advantage of the diffusion process and generate even better results rather than being just a simple filter.
After installing this Extension, you can see its sub-section in the img2img tab. The default parameters can already yield some decent results. Refer to the table below and play around with the values.
- Steps: How many times does it apply the noises
- Brightness: Offset the bounds of the luminance map
- Contrast: The upper and lower bounds of the luminance map
- Saturation: Alter the saturation of the input image
- Power: Use
Power
instead ofMultiplication
calculation for saturation modification; Lower Saturation if you enable this - Bloom: Zero the lower bound, so only the upper bound is processed; Increase Blur for better effects
- Grey: Generate a grey-scale instead of a full-color noise map
- Sigma: Affects how much noise is applied; Set to 0 to turn this Extension into just a basic Filter
- Blur: How strong should the luminance map be blurred
- Debug: When enabled, attach the intermediate steps to output
Base Image 512x512; img2img to 1024x1024; Same prompts; Same seed; Same settings
Base Image | Without Ext. |
\ | a | b | c | d | e |
Steps | 1 | 2 | 4 | 8 | 16 |
Brightness | 4 | 2 | 3 | -1 | 1 |
Contrast | 4 | 2 | 3 | 2 | 1 |
Saturation | 1.5 | 1.0 | 1.5 | 1.0 | 1.2 |
Sigma | 1.0 | 1.0 | 1.0 | 2.0 | 0.5 |
Blur | 64 | 16 | 16 | 8 | 4 |
Result |
- Extension Released
- Add Support for X/Y/Z Plot
- Append Parameters into Metadata
Implementation
What this Extension actually does:
When you run img2img, it first calculates a luminance map of the input image.
Then it blurs the map and scales the map to a range controlled by Brightness
and Contrast
.
The saturation of the input image is modified. And a noise map controlled by Sigma
is generated centered around the luminance map.
The noise map is finally applied to the input image for specified Steps
.
Footnotes
-
Yes. I know the actual Stable Diffusion pipeline works with the noise in the latent space. This Extension works entirely in the normal pixel space. And thus, this Extension has nothing to do with Offset Noise. ↩