Astridkraft commited on
Commit
c546297
·
verified ·
1 Parent(s): 41b20d0

Update controlnet_module.py

Browse files
Files changed (1) hide show
  1. controlnet_module.py +18 -19
controlnet_module.py CHANGED
@@ -1114,26 +1114,25 @@ class ControlNetProcessor:
1114
  # ============================================================
1115
  # Maske und Rohmaske auf Originalgröße transformieren
1116
  # ============================================================
1117
- print("🔄 MASKE IMMER ZURÜCK AUF 512x512 TRANSFORMIEREN")
1118
-
1119
- # Konvertierung NumPy->Pil
1120
- temp_mask = Image.fromarray(mask_array).convert("L")
1121
- print(f" Maskengröße auf Ausschnitt: {temp_mask.size}")
1122
-
1123
- # Maske auf 512x512 skalieren (für Inpainting)
1124
- mask_512 = temp_mask.resize((512,512), Image.Resampling.LANCZOS)
1125
- print(f" Maske auf 512x512 skaliert")
1126
-
1127
-
1128
- # raw_mask auch auf 512 skalieren (für UI-Konsistenz)
1129
- raw_mask_512 = Image.fromarray(raw_mask_array).convert("L").resize(
1130
- (512, 512), Image.Resampling.NEAREST
1131
- )
1132
-
1133
- # Bild-Referenz zurücksetzen
1134
- image = original_image
1135
- print(f" 🔄 Bild-Referenz wieder auf Original gesetzt: {image.size}")
1136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1137
  # ============================================================
1138
  # ABSCHLIESSENDE STATISTIK
1139
  # ============================================================
 
1114
  # ============================================================
1115
  # Maske und Rohmaske auf Originalgröße transformieren
1116
  # ============================================================
1117
+ print("🔄 MASKE AUF ORIGINALGRÖSSE TRANSFORMIEREN")
1118
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1119
 
1120
+
1121
+ # 1. Maske von Crop auf Original-Position übertragen
1122
+ mask_crop_pil = Image.fromarray(mask_array).convert("L")
1123
+
1124
+ # Leere Maske in Originalgröße
1125
+ mask_original = Image.new("L", original_image.size, 0)
1126
+
1127
+ # Crop-Maske an richtiger Position einfügen
1128
+ mask_original.paste(mask_crop_pil, (crop_x1, crop_y1))
1129
+
1130
+ # 2. Rohmaske ebenfalls transformieren
1131
+ raw_mask_crop_pil = Image.fromarray(raw_mask_array).convert("L")
1132
+ raw_mask_original = Image.new("L", original_image.size, 0)
1133
+ raw_mask_original.paste(raw_mask_crop_pil, (crop_x1, crop_y1))
1134
+
1135
+
1136
  # ============================================================
1137
  # ABSCHLIESSENDE STATISTIK
1138
  # ============================================================