From 7140ee86847621e5dd35731aabcf9d1441f14d90 Mon Sep 17 00:00:00 2001 From: iperov Date: Sun, 28 Apr 2019 19:34:56 +0400 Subject: [PATCH] Converter: fixed degrade color power after 'lct' --- imagelib/reduce_colors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imagelib/reduce_colors.py b/imagelib/reduce_colors.py index 4300d30..961f00d 100644 --- a/imagelib/reduce_colors.py +++ b/imagelib/reduce_colors.py @@ -4,7 +4,7 @@ from PIL import Image #n_colors = [0..256] def reduce_colors (img_bgr, n_colors): - img_rgb = (cv2.cvtColor(img_bgr, cv2.COLOR_BGR2RGB) * 255.0).astype(np.uint8) + img_rgb = (img_bgr[...,::-1] * 255.0).astype(np.uint8) img_rgb_pil = Image.fromarray(img_rgb) img_rgb_pil_p = img_rgb_pil.convert('P', palette=Image.ADAPTIVE, colors=n_colors)