optimization: Speed up image processing by 5-6x resizing images before grabbing palettes.

This commit is contained in:
Dylan Araps 2017-07-23 16:59:08 +10:00
parent 0c1d76e2b3
commit 38744ecf3e

View File

@ -11,8 +11,9 @@ from . import util
def imagemagick(color_count, img): def imagemagick(color_count, img):
"""Call Imagemagick to generate a scheme.""" """Call Imagemagick to generate a scheme."""
colors = subprocess.Popen(["convert", img, "+dither", "-colors", colors = subprocess.Popen(["convert", img, "-resize", "25%",
str(color_count), "-unique-colors", "txt:-"], "+dither", "-colors", str(color_count),
"-unique-colors", "txt:-"],
stdout=subprocess.PIPE) stdout=subprocess.PIPE)
return colors.stdout.readlines() return colors.stdout.readlines()