From 51d148df806feb42bfbf2327efdafa94456f2342 Mon Sep 17 00:00:00 2001 From: x-o-i-o-x <103693092+x-o-i-o-x@users.noreply.github.com> Date: Tue, 7 Oct 2025 13:15:13 +0200 Subject: [PATCH] composit and image updating fix --- paintModifier.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/paintModifier.py b/paintModifier.py index d6cf871..82bfc54 100644 --- a/paintModifier.py +++ b/paintModifier.py @@ -46,18 +46,21 @@ def apply_color(): print("PIL image sizes: ", paint_mask_image.size, target_image.size, new_image.size) print("PIL image modes: ", paint_mask_image.mode, target_image.mode, new_image.mode) - paint_mask_image.show() - target_image.show() - new_image.show() + # paint_mask_image.show() + # target_image.show() + # new_image.show() # Blend buffers - blended_image = Image.composite(target_image, new_image, paint_mask_image) + blended_image = Image.composite(new_image, target_image, paint_mask_image) + # blended_image.show() # Convert blended image back to numpy array and normalize - blended_pixels = np.asarray(blended_image).astype(np.float32) + # blended_pixels = np.asarray(blended_image).astype(np.float32) + blended_pixels = np.array(blended_image, dtype=np.uint8).astype(np.float32) / 255.0 # Save texture - normal_buffer.pixels[:] = blended_pixels.flatten() + # normal_buffer.pixels[:] = blended_pixels.flatten() + normal_buffer.pixels[:] = tuple(blended_pixels.reshape(-1)) normal_buffer.update() print("Color applied")