1
0
Fork 0

syntax fix, save noise image

This commit is contained in:
Sean Sube 2023-01-14 16:03:56 -06:00
parent b8b7dcf757
commit 4233c34813
2 changed files with 6 additions and 3 deletions

View File

@ -29,7 +29,7 @@ def blend_source_histogram(source_image: Image, dims: Tuple[int, int]) -> Tuple[
noise_b = random.choice(256, p=np.divide(np.copy(hist_b), np.sum(hist_b)), size=size)
noise_pixels = np.dstack((noise_r, noise_g, noise_b))
noise = Image.fromarray(np.reshape(noise_pixels), (width * 3, height)))
noise = Image.fromarray(np.reshape(noise_pixels, (width * 3, height)))
return noise
@ -59,4 +59,4 @@ def expand_image(source_image: Image, mask_image: Image, dims: Tuple[int, int, i
if mask_color[0] > 0:
full_source.putpixel((x, y), blend_op(source_color, mask_color, noise_color))
return (full_source, full_mask, (full_width, full_height))
return (full_source, full_mask, full_noise, (full_width, full_height))

View File

@ -272,7 +272,10 @@ def run_inpaint_pipeline(model, provider, scheduler, prompt, negative_prompt, cf
rng = np.random.RandomState(seed)
extra = 256
(full_source, full_mask, full_dims) = expand_image(source_image, mask_image, (extra, extra, extra, extra))
(full_source, full_mask, full_noise, full_dims) = expand_image(source_image, mask_image, (extra, extra, extra, extra))
full_source.save('%s-source' % (output))
full_noise.save('%s-noise' % (output))
image = pipe(
prompt,