fix loopback color correction to store color_correction info for initial image and use that instead of extracting from previous image in a loop #481 #541
This commit is contained in:
parent
3763837003
commit
b153ebe3b6
2 changed files with 7 additions and 2 deletions
|
@ -445,7 +445,9 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
|
||||||
|
|
||||||
latent_mask = self.latent_mask if self.latent_mask is not None else self.image_mask
|
latent_mask = self.latent_mask if self.latent_mask is not None else self.image_mask
|
||||||
|
|
||||||
self.color_corrections = []
|
add_color_corrections = opts.img2img_color_correction and self.color_corrections is None
|
||||||
|
if add_color_corrections:
|
||||||
|
self.color_corrections = []
|
||||||
imgs = []
|
imgs = []
|
||||||
for img in self.init_images:
|
for img in self.init_images:
|
||||||
image = img.convert("RGB")
|
image = img.convert("RGB")
|
||||||
|
@ -467,7 +469,7 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
|
||||||
if self.inpainting_fill != 1:
|
if self.inpainting_fill != 1:
|
||||||
image = fill(image, latent_mask)
|
image = fill(image, latent_mask)
|
||||||
|
|
||||||
if opts.img2img_color_correction:
|
if add_color_corrections:
|
||||||
self.color_corrections.append(setup_color_correction(image))
|
self.color_corrections.append(setup_color_correction(image))
|
||||||
|
|
||||||
image = np.array(image).astype(np.float32) / 255.0
|
image = np.array(image).astype(np.float32) / 255.0
|
||||||
|
|
|
@ -40,6 +40,9 @@ class Script(scripts.Script):
|
||||||
all_images = []
|
all_images = []
|
||||||
state.job_count = loops * batch_count
|
state.job_count = loops * batch_count
|
||||||
|
|
||||||
|
if opts.img2img_color_correction:
|
||||||
|
p.color_corrections = [processing.setup_color_correction(p.init_images[0])]
|
||||||
|
|
||||||
for n in range(batch_count):
|
for n in range(batch_count):
|
||||||
history = []
|
history = []
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue