From 08a47465c57bac0af498a531446cab0816b666af Mon Sep 17 00:00:00 2001 From: mattmcw Date: Wed, 29 Nov 2023 18:33:02 -0500 Subject: [PATCH] Fixed output paths for stipple_gen command --- py/posterize.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/py/posterize.py b/py/posterize.py index 2b38ebf..4f6c4ca 100644 --- a/py/posterize.py +++ b/py/posterize.py @@ -16,7 +16,6 @@ class Posterize: pallete = None pallete_space = 'BGR' - comparison_space = 'BGR' image = None @@ -91,7 +90,7 @@ class Posterize: for i in range(self.n_colors) : if list_match(self.original_colors[i], white) : continue - original = self.original_colors[i] #BGR + original = self.original_colors[i] mask = self.extract_color_mask(self.image, original) original_normalized = convert_color(original, 'BGR', self.pallete_space) if self.pallete_space == 'RGB' or self.pallete_space == 'BGR' : @@ -108,9 +107,6 @@ class Posterize: 'color' : closest, 'space' : self.pallete_space }) - #color_mat = create_colored_image(self.w, self.h, closest) - #color_mask = cv2.bitwise_or(color_mat, color_mat, mask = (255-mask)) - #color_mask = cv2.inRange(mask, np.array([0, 0, 0]), np.array([1, 1, 1])) mask = cv2.bitwise_not(mask) composite[mask > 0] = np.array(closest) @@ -143,9 +139,8 @@ class Posterize: ratio = black/total max_particles = round(ratio * self.max_particles) input_image = os.path.abspath(layer['layer']) - file_name, dir_name = os.path.split(input_image) + dir_name, file_name = os.path.split(input_image) file_part, ext = os.path.splitext(file_name) - output_image = os.path.join(dir_name, f'{file_part}_preview.png') output_svg = os.path.join(dir_name, f'{file_part}.svg') cmd = [ @@ -158,11 +153,11 @@ class Posterize: '--maxParticles', str(max_particles) ] print(cmd) - #subprocess.call(cmd, cwd = self.stipple_gen) + subprocess.call(cmd, cwd = self.stipple_gen) self.previews.append(output_image) def preview (self) : - - + #composite = create_colored_image(self.w, self.h, [255, 255, 255]) + print(self.previews)