From 1210266c95182fa5ca5f18811044e78b2b3fa28c Mon Sep 17 00:00:00 2001 From: katboi01 Date: Sun, 16 Feb 2025 04:34:27 +0800 Subject: [PATCH] Fixed cropping --- decode.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/decode.py b/decode.py index 2b75f50..a1b59c6 100644 --- a/decode.py +++ b/decode.py @@ -22,15 +22,16 @@ def convert(in_path, out_path, file_name): im : Image = data.image width, height = im.size - left = int((width - 2) * 0.8) + left = int(width * 0.8) + padding = 1 - im1 = im.crop((0, 0, left, height)) + im1 = im.crop((0, 0, left - padding, height)) im1_array = np.asarray(im1, dtype=np.float32) / 255 y_channel = im1_array[:, :, 0] alpha_channel = im1_array[:, :, 2] - im2 = im.crop((left+2, 0, width, height)).resize((left, height), Image.NEAREST) + im2 = im.crop((left + padding, 0, width, height)).resize((left - padding, height), Image.NEAREST) im2_array = np.asarray(im2, dtype=np.float32) / 255 cr_channel = im2_array[:, :, 0]