fill color is parameterized

This commit is contained in:
Lincoln Stein 2023-01-31 17:52:33 -05:00
parent 6556b200b5
commit d3d24fa816

View File

@ -184,6 +184,7 @@ class Inpaint(Img2Img):
infill_method = None, infill_method = None,
inpaint_width=None, inpaint_width=None,
inpaint_height=None, inpaint_height=None,
inpaint_fill:tuple(int)=(0x7F, 0x7F, 0x7F, 0xFF),
attention_maps_callback=None, attention_maps_callback=None,
**kwargs): **kwargs):
""" """
@ -211,7 +212,7 @@ class Inpaint(Img2Img):
tile_size = tile_size tile_size = tile_size
) )
elif infill_method == 'solid': elif infill_method == 'solid':
solid_bg = PIL.Image.new("RGBA", init_image.size, (0x7F, 0x7F, 0x7F, 0xFF)) solid_bg = PIL.Image.new("RGBA", init_image.size, inpaint_fill)
init_filled = PIL.Image.alpha_composite(solid_bg, init_image) init_filled = PIL.Image.alpha_composite(solid_bg, init_image)
else: else:
raise ValueError(f"Non-supported infill type {infill_method}", infill_method) raise ValueError(f"Non-supported infill type {infill_method}", infill_method)