From 8fb676cb6909ced4eac3689e7d0a388b0d0c0c84 Mon Sep 17 00:00:00 2001 From: JM Date: Sun, 28 Sep 2025 13:59:03 +0300 Subject: [PATCH] fix reused variable --- library/train_util.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/train_util.py b/library/train_util.py index 91057fa8..deb6dbc4 100644 --- a/library/train_util.py +++ b/library/train_util.py @@ -2514,8 +2514,9 @@ def load_image(image_path, alpha=False): if "A" in image.getbands(): # Replace transparency with white background. + alpha_layer = image.convert('RGBA').split()[-1] bg = Image.new("RGBA", image.size, (255, 255, 255, 255) ) - bg.paste(image, mask=alpha) + bg.paste( image, mask=alpha_layer ) image = bg.convert('RGB') if not image.mode == "RGB":