diff --git a/modules/image/resize.py b/modules/image/resize.py index 22841e6e5..53a64b80a 100644 --- a/modules/image/resize.py +++ b/modules/image/resize.py @@ -51,7 +51,7 @@ def resize_image(resize_mode: int, im: Image.Image | torch.Tensor, width: int, h else: im = selected_upscaler.scaler.upscale(im, scale, selected_upscaler.name) else: - log.warning(f"Resize upscaler: invalid={upscaler_name} fallback={selected_upscaler.name}") + log.warning(f"Resize upscaler: invalid={upscaler_name} fallback=resample") log.debug(f"Resize upscaler: available={[u.name for u in shared.sd_upscalers]}") if isinstance(im, Image.Image) and (im.width != w or im.height != h): # probably downsample after upscaler created larger image im = sharpfin.resize(im, (w, h)) diff --git a/scripts/postprocessing_rembg.py b/scripts/postprocessing_rembg.py index 9e3bba6e4..41456aade 100644 --- a/scripts/postprocessing_rembg.py +++ b/scripts/postprocessing_rembg.py @@ -98,14 +98,13 @@ class ScriptPostprocessingRembg(scripts_postprocessing.ScriptPostprocessing): log.error(f'RemoveBackground: model={model} {e}') return pp - if mask_only and pp.image.mode == "RGBA": - _r, _g, _b, alpha = pp.image.split() + if mask_only and image.mode == "RGBA": + _r, _g, _b, alpha = image.split() image = alpha - if merge_alpha and pp.image.mode == "RGBA": - flattened = Image.new("RGBA", pp.image.size, "BLACK") - flattened.paste(pp.image, mask=pp.image) - flattened.convert("RGB") - image = flattened + if merge_alpha and image.mode == "RGBA": + flattened = Image.new("RGBA", image.size, "BLACK") + flattened.paste(image, mask=image) + image = flattened.convert("RGB") if isinstance(pp, Image.Image): pp = scripts_postprocessing.PostprocessedImage(image=image, info={**info, "Rembg": model}) diff --git a/scripts/postprocessing_upscale.py b/scripts/postprocessing_upscale.py index 826a313ee..8f5144d6e 100644 --- a/scripts/postprocessing_upscale.py +++ b/scripts/postprocessing_upscale.py @@ -112,5 +112,6 @@ class ScriptPostprocessingUpscaleSimple(ScriptPostprocessingUpscale): upscaler1 = next(iter([x for x in shared.sd_upscalers if x.name == upscaler_name]), None) if upscaler1 is None: log.debug(f"Upscaler not found: {upscaler_name}") + return pp.image = self.upscale(pp.image, pp.info, upscaler1, 0, upscale_by, 0, 0, False) pp.info["Postprocess upscaler"] = upscaler1.name diff --git a/scripts/sd_upscale.py b/scripts/sd_upscale.py index 2b1b87f81..0d19e5eb4 100644 --- a/scripts/sd_upscale.py +++ b/scripts/sd_upscale.py @@ -29,7 +29,7 @@ class SDUpscaleScript(scripts_manager.Script): init_img = None if hasattr(p, 'init_images') and p.init_images is not None: init_img = p.init_images[0] - elif hasattr(p.task_args, 'image') and p.task_args['image'] is not None: + elif p.task_args.get('image', None) is not None: init_img = p.task_args['image'][0] if init_img is None: