V 2.0.0 - Rasterix - pbar

This commit is contained in:
DESKTOP-TVBJISQ\Primere
2026-03-23 08:34:33 +01:00
parent 9e90518c86
commit 1a71387977
2 changed files with 215 additions and 212 deletions
+13 -9
View File
@@ -2180,11 +2180,11 @@ class PrimereRasterix:
"precision": ("BOOLEAN", {"default": False, "label_off": "8 bit", "label_on": "16 bit"}),
"auto_normalize": ("BOOLEAN", {"default": False, "label_off": "No auto levels", "label_on": "Apply auto levels"}),
"auto_levels_threshold": ("FLOAT", {"default": 2.0, "min": 0.0, "max": 10.0, "step": 0.1}),
"normalize_gaps": ("BOOLEAN", {"default": True, "label_on": "Anti-comb filter: ON", "label_off": "Anti-comb filter: OFF"}),
"auto_levels_threshold": ("FLOAT", {"default": 0.2, "min": 0.0, "max": 10.0, "step": 0.1}),
"normalize_gaps": ("BOOLEAN", {"default": False, "label_on": "Anti-comb filter: ON", "label_off": "Anti-comb filter: OFF"}),
"normalize_midpeaks": ("BOOLEAN", {"default": False, "label_on": "Anti-spike filter: ON", "label_off": "Anti-spike filter: OFF"}),
"peak_width": ("INT", {"default": 3, "min": 1, "max": 10, "step": 1}),
"auto_gamma": ("BOOLEAN", {"default": True, "label_on": "Auto gamma: ON", "label_off": "Auto gamma:: OFF"}),
"auto_gamma": ("BOOLEAN", {"default": False, "label_on": "Auto gamma: ON", "label_off": "Auto gamma:: OFF"}),
"gamma_target": ("FLOAT", {"default": 128.0, "min": 0.0, "max": 255.0, "step": 0.1}),
"use_white_balance": ("BOOLEAN", {"default": False, "label_off": "Ignore white balance", "label_on": "Apply white balance"}),
@@ -2247,7 +2247,7 @@ class PrimereRasterix:
"adb_unsharp_percent": ("INT", {"default": 38, "min": 0, "max": 150, "step": 1}),
"adb_jpeg_cycles": ("INT", {"default": 4, "min": 0, "max": 6, "step": 1}),
"final_peaks": ("BOOLEAN", {"default": False, "label_on": "End peak normalization: ON", "label_off": "End peak normalization: OFF"}),
# "final_peaks": ("BOOLEAN", {"default": False, "label_on": "End peak normalization: ON", "label_off": "End peak normalization: OFF"}),
"show_histogram": ("BOOLEAN", {"default": False, "label_off": "Show output histogram", "label_on": "Show input histogram"}),
"histogram_channel": (["RGB", "RED", "GREEN", "BLUE"], {"default": "RGB"}),
@@ -2259,7 +2259,7 @@ class PrimereRasterix:
}
}
def primere_rasterix(self, concepts, models, image, precision, auto_normalize, auto_levels_threshold, normalize_gaps, normalize_midpeaks, peak_width, auto_gamma, gamma_target, use_white_balance, wb_temperature, wb_tint, use_blur, blur_type, blur_intensity, blur_radius, angle, bilateral_edge_sensitivity, blur_edge_only, edge_threshold, use_smart_lighting, smart_lighting, use_brightness_contrast, brightness, contrast, use_legacy, use_film_rendering, film_rendering, film_rendering_intensity, use_selective_tone, selective_tone_value, selective_tone_zone, selective_tone_separation, selective_tone_strength, use_color_balance, color_balance_cyan_red, color_balance_magenta_green, color_balance_yellow_blue, color_balance_tone, color_balance_preserve_luminosity, color_balance_separation, use_hsl, hsl_hue, hsl_saturation, hsl_lightness, hsl_vibrance, hsl_channel, hsl_channel_width, hsl_skin_protection, use_shade_detailer, shade_level, shade_radius, detail_mode, shade_strength, use_ai_detection_bypasser, adb_freq_strength, adb_variance_strength, adb_unsharp_percent, adb_jpeg_cycles, final_peaks, show_histogram=False, histogram_channel="RGB", histogram_style="gradient", model_concept=None, model_name=None):
def primere_rasterix(self, concepts, models, image, precision, auto_normalize, auto_levels_threshold, normalize_gaps, normalize_midpeaks, peak_width, auto_gamma, gamma_target, use_white_balance, wb_temperature, wb_tint, use_blur, blur_type, blur_intensity, blur_radius, angle, bilateral_edge_sensitivity, blur_edge_only, edge_threshold, use_smart_lighting, smart_lighting, use_brightness_contrast, brightness, contrast, use_legacy, use_film_rendering, film_rendering, film_rendering_intensity, use_selective_tone, selective_tone_value, selective_tone_zone, selective_tone_separation, selective_tone_strength, use_color_balance, color_balance_cyan_red, color_balance_magenta_green, color_balance_yellow_blue, color_balance_tone, color_balance_preserve_luminosity, color_balance_separation, use_hsl, hsl_hue, hsl_saturation, hsl_lightness, hsl_vibrance, hsl_channel, hsl_channel_width, hsl_skin_protection, use_shade_detailer, shade_level, shade_radius, detail_mode, shade_strength, use_ai_detection_bypasser, adb_freq_strength, adb_variance_strength, adb_unsharp_percent, adb_jpeg_cycles, show_histogram=False, histogram_channel="RGB", histogram_style="gradient", model_concept=None, model_name=None):
pil_img = utility.tensor_to_image(image)
pil_img_input = pil_img.copy()
@@ -2304,20 +2304,24 @@ class PrimereRasterix:
rad = vals.get('shade_radius', 0)
pil_img = img_shade_level.img_shade_level(image=pil_img, shade_level=lvl, radius=rad, strength=shade_strength)
if final_peaks:
pil_img = img_levels_auto.img_levels_auto(image=pil_img, auto_normalize=True, threshold=0, normalize_gaps=False, normalize_midpeaks=True, peak_width=peak_width, auto_gamma=False, gamma_target=128)
# if final_peaks:
# pil_img = img_levels_auto.img_levels_auto(image=pil_img, auto_normalize=True, threshold=0, normalize_gaps=False, normalize_midpeaks=True, peak_width=peak_width, auto_gamma=False, gamma_target=128)
if use_ai_detection_bypasser:
pil_img = isgen_detect_ext_full.bypass_ai_detector(image=pil_img, freq_strength=adb_freq_strength, variance_strength=adb_variance_strength, unsharp_percent=adb_unsharp_percent, jpeg_cycles=adb_jpeg_cycles)
hist_dir = os.path.join(PRIMERE_ROOT, 'front_end', 'images')
rendered = {}
for st in ("bars", "lines", "waveform", "heatmap", "stacked", "luma", "parade"):
for ch in ("RGB", "RED", "GREEN", "BLUE"):
hstyle = ["bars", "lines", "waveform", "heatmap", "stacked", "luma", "parade"]
hchannels = ["RGB", "RED", "GREEN", "BLUE"]
pbar = comfy.utils.ProgressBar(len(hstyle) * len(hchannels))
for st in hstyle:
for ch in hchannels:
rendered[("in", ch, st)] = histogram.rasterix_histogram_render(pil_img_input, ch, st, precision)
rendered[("out", ch, st)] = histogram.rasterix_histogram_render(pil_img, ch, st, precision)
rendered[("in", ch, st)].save(os.path.join(hist_dir, f'input_histogram_{ch.lower()}_{st}.jpg'), quality=90)
rendered[("out", ch, st)].save(os.path.join(hist_dir, f'output_histogram_{ch.lower()}_{st}.jpg'), quality=90)
pbar.update(1)
active_hist = rendered[("in" if show_histogram else "out", histogram_channel, histogram_style)]
suffix = ''.join(random.choice("abcdefghijklmnopqrstuvwxyz0123456789") for _ in range(8))
+202 -203
View File
@@ -1,78 +1,9 @@
{
"id": "62d65e47-8be4-48ae-9938-685c574da4f3",
"revision": 0,
"last_node_id": 43,
"last_link_id": 81,
"last_node_id": 47,
"last_link_id": 89,
"nodes": [
{
"id": 4,
"type": "PrimereResolutionMultiplierMPX",
"pos": [
206.38969459574838,
-251.76943638206146
],
"size": [
270.330078125,
262
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [
{
"name": "width",
"type": "INT",
"link": 6
},
{
"name": "height",
"type": "INT",
"link": 7
},
{
"name": "image",
"shape": 7,
"type": "IMAGE",
"link": 3
}
],
"outputs": [
{
"name": "WIDTH",
"type": "INT",
"links": null
},
{
"name": "HEIGHT",
"type": "INT",
"links": null
},
{
"name": "UPSCALE_RATIO",
"type": "FLOAT",
"links": null
},
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
80
]
}
],
"properties": {
"Node name for S&R": "PrimereResolutionMultiplierMPX"
},
"widgets_values": [
true,
1,
true,
20,
2,
"None",
"bicubic"
]
},
{
"id": 5,
"type": "GetImageSize+",
@@ -133,12 +64,12 @@
],
"flags": {},
"order": 4,
"mode": 0,
"mode": 4,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 81
"link": 89
}
],
"outputs": [
@@ -216,7 +147,7 @@
],
"flags": {},
"order": 5,
"mode": 0,
"mode": 4,
"inputs": [
{
"name": "image",
@@ -259,153 +190,72 @@
]
},
{
"id": 2,
"type": "LoadImage",
"id": 4,
"type": "PrimereResolutionMultiplierMPX",
"pos": [
-71.29003299076548,
187.79952200018283
206.38969459574838,
-251.76943638206146
],
"size": [
847.8209835466038,
1173.17325790213
270.330078125,
262
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
3,
5
]
},
{
"name": "MASK",
"type": "MASK",
"links": null
}
],
"properties": {
"Node name for S&R": "LoadImage"
},
"widgets_values": [
"Image_A659_20260602_190430_102020915537757_1984x3176_1.jpg",
"image"
]
},
{
"id": 43,
"type": "PrimereRasterix",
"pos": [
796.6007994467783,
-235.88225949091918
],
"size": [
448.60015207866036,
1822
],
"flags": {},
"order": 3,
"mode": 0,
"order": 2,
"mode": 4,
"inputs": [
{
"name": "width",
"type": "INT",
"link": 6
},
{
"name": "height",
"type": "INT",
"link": 7
},
{
"name": "image",
"shape": 7,
"type": "IMAGE",
"link": 80
},
{
"name": "model_concept",
"shape": 7,
"type": "STRING",
"link": null
},
{
"name": "model_name",
"shape": 7,
"type": "CHECKPOINT_NAME",
"link": null
"link": 3
}
],
"outputs": [
{
"name": "WIDTH",
"type": "INT",
"links": null
},
{
"name": "HEIGHT",
"type": "INT",
"links": null
},
{
"name": "UPSCALE_RATIO",
"type": "FLOAT",
"links": null
},
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
81
88
]
}
],
"properties": {
"Node name for S&R": "PrimereRasterix"
"Node name for S&R": "PrimereResolutionMultiplierMPX"
},
"widgets_values": [
"Auto",
"Auto",
true,
1,
true,
0.1,
true,
true,
3,
true,
110,
true,
6500,
0,
true,
20.03704833984375,
false,
"bilateral",
0,
20,
2,
0,
0.5,
false,
0,
false,
0,
0,
false,
true,
"canon_5d_mark2_CCD",
200,
true,
-6,
"highlights",
50,
0.5,
false,
0,
0,
0,
"highlights",
false,
50,
true,
0,
-2.629638671875,
-7.703857421875,
8.37030029296875,
"master",
50,
true,
true,
5.5555419921875,
1.5,
"fine",
0.5,
true,
0.019,
0.32,
38,
4,
true,
false,
"RGB",
"bars"
"None",
"bicubic"
]
},
{
@@ -452,6 +302,155 @@
"ERROR: Cannot list target for Checkpoint",
null
]
},
{
"id": 2,
"type": "LoadImage",
"pos": [
-71.29003299076548,
187.79952200018283
],
"size": [
847.8209835466038,
1173.17325790213
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
3,
5
]
},
{
"name": "MASK",
"type": "MASK",
"links": null
}
],
"properties": {
"Node name for S&R": "LoadImage"
},
"widgets_values": [
"Image_A665_20260902_022607_111887358084773_1872x3344_1.jpg",
"image"
]
},
{
"id": 47,
"type": "PrimereRasterix",
"pos": [
796.0573009725758,
-246.97599137501211
],
"size": [
453.9414985036317,
1816.7358977703848
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 88
},
{
"name": "model_concept",
"shape": 7,
"type": "STRING",
"link": null
},
{
"name": "model_name",
"shape": 7,
"type": "CHECKPOINT_NAME",
"link": null
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
89
]
}
],
"properties": {
"Node name for S&R": "PrimereRasterix"
},
"widgets_values": [
"Auto",
"Auto",
true,
true,
0.2,
true,
true,
3,
false,
128,
false,
6500,
0,
false,
0,
false,
"bilateral",
0,
2,
0,
0.5,
false,
0,
false,
0,
0,
false,
false,
"kodak_kodachrome_64_CF",
100,
false,
0,
"midtones",
50,
0.5,
false,
0,
0,
0,
"midtones",
false,
50,
false,
0,
0,
0,
0,
"master",
50,
true,
false,
0,
0,
"medium",
0.5,
false,
0.019,
0.32,
38,
4,
false,
"RGB",
"bars"
]
}
],
"links": [
@@ -504,16 +503,16 @@
"IMAGE"
],
[
80,
88,
4,
3,
43,
47,
0,
"IMAGE"
],
[
81,
43,
89,
47,
0,
27,
0,
@@ -524,10 +523,10 @@
"config": {},
"extra": {
"ds": {
"scale": 0.6934334949441732,
"scale": 0.6934334949441758,
"offset": [
795.0106485186893,
330.2327009981918
562.1560040420882,
333.72248743687595
]
},
"frontendVersion": "1.41.21"