From 07644f03486e4812ac85839b5eaba9f8bbbf890a Mon Sep 17 00:00:00 2001 From: tassaron Date: Mon, 22 May 2017 19:42:32 -0400 Subject: text and visualization colour can be changed using commandline --- core.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'core.py') diff --git a/core.py b/core.py index 92b0d0e..b693837 100644 --- a/core.py +++ b/core.py @@ -42,7 +42,8 @@ class Core(): else: return self.getVideoFrames(backgroundImage, preview) - def drawBaseImage(self, backgroundFile, titleText, titleFont, fontSize, alignment, xOffset, yOffset): + def drawBaseImage(self, backgroundFile, titleText, titleFont, fontSize, alignment,\ + xOffset, yOffset, textColor, visColor): if backgroundFile == '': im = Image.new("RGB", (1280, 720), "black") else: @@ -62,7 +63,7 @@ class Core(): font = titleFont font.setPointSizeF(fontSize) painter.setFont(font) - painter.setPen(QColor(255, 255, 255)) + painter.setPen(QColor(*textColor)) yPosition = yOffset @@ -86,13 +87,15 @@ class Core(): strio.seek(0) return Image.open(strio) - def drawBars(self, spectrum, image): + def drawBars(self, spectrum, image, color): imTop = Image.new("RGBA", (1280, 360)) draw = ImageDraw.Draw(imTop) + r, g, b = color + color2 = (r, g, b, 50) for j in range(0, 63): - draw.rectangle((10 + j * 20, 325, 10 + j * 20 + 20, 325 - spectrum[j * 4] * 1 - 10), fill=(255, 255, 255, 50)) - draw.rectangle((15 + j * 20, 320, 15 + j * 20 + 10, 320 - spectrum[j * 4] * 1), fill="white") + draw.rectangle((10 + j * 20, 325, 10 + j * 20 + 20, 325 - spectrum[j * 4] * 1 - 10), fill=color2) + draw.rectangle((15 + j * 20, 320, 15 + j * 20 + 10, 320 - spectrum[j * 4] * 1), fill=color) imBottom = imTop.transpose(Image.FLIP_TOP_BOTTOM) -- cgit v1.2.3