main
Haoming 2025-12-30 15:28:05 +08:00
parent 39a4aeba45
commit ff384b6f2f
5 changed files with 83 additions and 7 deletions

View File

@ -1,3 +1,6 @@
### v2.4.0 - 2025 Dec.30
- Implement Randomize for **Noise** and **Scaling**
### v2.3.2 - 2024 Nov.06
- Linting *(`internal`)*

View File

@ -232,7 +232,8 @@ Hires upscale: 1.5, Hires steps: 12, Hires upscaler: 2xNomosUni_esrgan_multijpg
> The following settings are in the **Vectorscope CC** section under the **Stable Diffusion** category of the **Settings** tab
- Append the parameters to the infotext
- Disable `do_not_save_to_config` to use the Webui **Defaults** functionality
- Disable `do_not_save_to_config` to use the Webui's **Defaults** feature
- Also randomize the **Noise** and **Scaling** settings
- Set the `minimum` and `maximum` range for each parameter
## Roadmap
@ -331,7 +332,7 @@ In the **Script** `Dropdown` at the bottom, there is now a new **`High Dynamic R
- **(Recommended)** Use a deterministic sampler and high enough steps. `Euler` *(**not** `Euler a`)* works well in my experience
#### Options
- **Brackets:** The numer of images to generate
- **Brackets:** The number of images to generate
- **Gaps:** The brightness difference between each image
- **Automatically Merge:** When enabled, this will merge the images using an `OpenCV` algorithm and save to the `HDR` folder in the `outputs` folder
- Disable this if you want to merge them yourself using better external program

View File

@ -1,4 +1,5 @@
from modules.shared import opts
import gradio as gr
import random
@ -47,3 +48,41 @@ def init():
getattr(opts, "cc_color_max", 4.0),
0.0,
)
def rand_method(*, orig=None):
if not opts.cc_rand_method:
return gr.update() if orig is None else orig
v = random.choice(
(
"Straight",
"Straight Abs.",
"Cross",
"Cross Abs.",
"Ones",
"N.Random",
"U.Random",
"Multi-Res",
"Multi-Res Abs.",
)
)
return gr.update(value=v) if orig is None else v
def rand_scaling(*, orig=None):
if not opts.cc_rand_scaling:
return gr.update() if orig is None else orig
v = random.choice(
(
"Flat",
"Cos",
"Sin",
"1 - Cos",
"1 - Sin",
)
)
return gr.update(value=v) if orig is None else v

View File

@ -27,11 +27,31 @@ def settings():
category_id="sd",
onchange=reset_ui_config,
)
.info("uncheck this option if you wish to use the built-in Defaults function")
.info("disable this option if you wish to use the built-in Defaults feature")
.info("enable again if the extension is not working correctly after an update")
.needs_reload_ui(),
)
opts.add_option(
"cc_rand_method",
OptionInfo(
False,
"Randomize the Noise Settings as well",
section=section,
category_id="sd",
),
)
opts.add_option(
"cc_rand_scaling",
OptionInfo(
False,
"Randomize the Scaling Settings as well",
section=section,
category_id="sd",
),
)
for lbl, minVal, maxVal in [
("Brightness", (-5.0, 0.0), (0.0, 5.0)),
("Contrast", (-5.0, 0.0), (0.0, 5.0)),

View File

@ -2,6 +2,7 @@ from modules.sd_samplers_kdiffusion import KDiffusionSampler
from modules.shared import opts
from modules import scripts
from lib_cc.const import rand_method, rand_scaling
from lib_cc.colorpicker import create_colorpicker
from lib_cc.callback import hook_callbacks
from lib_cc.style import StyleManager
@ -12,7 +13,7 @@ from random import seed
import gradio as gr
VERSION = "2.3.2"
VERSION = "2.4.0"
style_manager = StyleManager()
@ -242,6 +243,8 @@ class VectorscopeCC(scripts.Script):
gr.update(value=const.Color.rand()),
gr.update(value=const.Color.rand()),
gr.update(value=const.Color.rand()),
rand_method(),
rand_scaling(),
]
reset_btn.click(
@ -256,7 +259,7 @@ class VectorscopeCC(scripts.Script):
random_btn.click(
fn=on_random,
outputs=[bri, con, sat, r, g, b],
outputs=[bri, con, sat, r, g, b, method, scaling],
show_progress="hidden",
).then(
fn=None,
@ -360,13 +363,23 @@ class VectorscopeCC(scripts.Script):
g = const.Color.rand()
b = const.Color.rand()
print(f"\n[Seed: {cc_seed}]")
print(f"\n\n[Seed: {cc_seed}]")
print(f"> Brightness: {bri}")
print(f"> Contrast: {con}")
print(f"> Saturation: {sat}")
print(f"> R: {r}")
print(f"> G: {g}")
print(f"> B: {b}\n")
print(f"> B: {b}")
if getattr(opts, "cc_rand_method", False):
method = rand_method(orig=method)
print(f"> Noise: {method}")
if getattr(opts, "cc_rand_scaling", False):
scaling = rand_method(orig=scaling)
print(f"> Scaling: {scaling}")
print("\n")
if getattr(opts, "cc_metadata", True):
p.extra_generation_params.update(