From 85dcfd73ade31dbdaa443298c58cd1a3afbc8187 Mon Sep 17 00:00:00 2001 From: Jordan Thompson Date: Wed, 29 Mar 2023 20:12:19 -0700 Subject: [PATCH] Update WAS_Node_Suite.py Patch color palette generator for odd sizes --- WAS_Node_Suite.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WAS_Node_Suite.py b/WAS_Node_Suite.py index 0cd3d33..9f58e6c 100644 --- a/WAS_Node_Suite.py +++ b/WAS_Node_Suite.py @@ -399,7 +399,7 @@ class WAS_Filter_Class(): # Get the cluster centers and convert them to integer values cluster_centers = np.uint8(kmeans.cluster_centers_) # Calculate the size of the palette image based on the number of colors - palette_size = (cell_size * int(np.sqrt(n_colors)), cell_size * int(np.sqrt(n_colors))) + palette_size = (cell_size * (int(np.sqrt(n_colors))+1)//2*2, cell_size * (int(np.sqrt(n_colors))+1)//2*2) # Create a square image with the cluster centers as the color palette palette = Image.new('RGB', palette_size, color='white') draw = ImageDraw.Draw(palette) @@ -887,6 +887,7 @@ class WAS_Image_Color_Palette: res_dir = os.path.join(WAS_SUITE_ROOT, 'res') font = os.path.join(res_dir, 'font.ttf') + print(font) if not os.path.exists(font): font = None