From 38744ecf3e410d73bd69807e8912e4af33643843 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 23 Jul 2017 16:59:08 +1000 Subject: [PATCH] optimization: Speed up image processing by 5-6x resizing images before grabbing palettes. --- pywal/colors.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pywal/colors.py b/pywal/colors.py index 0ede3e1..18a237a 100644 --- a/pywal/colors.py +++ b/pywal/colors.py @@ -11,8 +11,9 @@ from . import util def imagemagick(color_count, img): """Call Imagemagick to generate a scheme.""" - colors = subprocess.Popen(["convert", img, "+dither", "-colors", - str(color_count), "-unique-colors", "txt:-"], + colors = subprocess.Popen(["convert", img, "-resize", "25%", + "+dither", "-colors", str(color_count), + "-unique-colors", "txt:-"], stdout=subprocess.PIPE) return colors.stdout.readlines()