mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-12-29 19:05:05 +08:00
fix upscaler 2 images do not match
This commit is contained in:
parent
aa4a45187e
commit
86861f8379
@ -45,7 +45,7 @@ class ScriptPostprocessingUpscale(scripts_postprocessing.ScriptPostprocessing):
|
|||||||
with gr.Column(scale=4):
|
with gr.Column(scale=4):
|
||||||
upscaling_resize = gr.Slider(minimum=1.0, maximum=8.0, step=0.05, label="Resize", value=4, elem_id="extras_upscaling_resize")
|
upscaling_resize = gr.Slider(minimum=1.0, maximum=8.0, step=0.05, label="Resize", value=4, elem_id="extras_upscaling_resize")
|
||||||
with gr.Column(scale=1, min_width=160):
|
with gr.Column(scale=1, min_width=160):
|
||||||
max_side_length = gr.Number(label="Max side length", value=0, elem_id="extras_upscale_max_side_length", tooltip="If any of two sides of the image ends up larger than specified, will downscale it to fit. 0 = no limit.", min_width=160)
|
max_side_length = gr.Number(label="Max side length", value=0, elem_id="extras_upscale_max_side_length", tooltip="If any of two sides of the image ends up larger than specified, will downscale it to fit. 0 = no limit.", min_width=160, step=8, minimum=0)
|
||||||
|
|
||||||
with gr.TabItem('Scale to', elem_id="extras_scale_to_tab") as tab_scale_to:
|
with gr.TabItem('Scale to', elem_id="extras_scale_to_tab") as tab_scale_to:
|
||||||
with FormRow():
|
with FormRow():
|
||||||
@ -154,6 +154,8 @@ class ScriptPostprocessingUpscale(scripts_postprocessing.ScriptPostprocessing):
|
|||||||
|
|
||||||
if upscaler2 and upscaler_2_visibility > 0:
|
if upscaler2 and upscaler_2_visibility > 0:
|
||||||
second_upscale = self.upscale(pp.image, pp.info, upscaler2, upscale_mode, upscale_by, max_side_length, upscale_to_width, upscale_to_height, upscale_crop)
|
second_upscale = self.upscale(pp.image, pp.info, upscaler2, upscale_mode, upscale_by, max_side_length, upscale_to_width, upscale_to_height, upscale_crop)
|
||||||
|
if upscaled_image.mode != second_upscale.mode:
|
||||||
|
second_upscale = second_upscale.convert(upscaled_image.mode)
|
||||||
upscaled_image = Image.blend(upscaled_image, second_upscale, upscaler_2_visibility)
|
upscaled_image = Image.blend(upscaled_image, second_upscale, upscaler_2_visibility)
|
||||||
|
|
||||||
pp.info["Postprocess upscaler 2"] = upscaler2.name
|
pp.info["Postprocess upscaler 2"] = upscaler2.name
|
||||||
|
Loading…
Reference in New Issue
Block a user