From 6a1deb9b781890f9a62a6f6ce608856c1fc9e720 Mon Sep 17 00:00:00 2001 From: DH4 Date: Tue, 6 Jun 2017 04:04:42 -0500 Subject: Add checkerboard for transpart frames. --- background.png | Bin 3711 -> 45367 bytes preview_thread.py | 8 +++++++- video_thread.py | 8 +++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/background.png b/background.png index 7a33158..fb58593 100644 Binary files a/background.png and b/background.png differ diff --git a/preview_thread.py b/preview_thread.py index 5116707..04683ae 100644 --- a/preview_thread.py +++ b/preview_thread.py @@ -6,6 +6,8 @@ import core import time from queue import Queue, Empty import numpy +import os +from copy import copy class Worker(QtCore.QObject): @@ -19,6 +21,9 @@ class Worker(QtCore.QObject): self.queue = queue self.core.settings = parent.settings self.stackedWidget = parent.window.stackedWidget + self.background = Image.new("RGBA", (1920, 1080),(0,0,0,0)) + self.background.paste(Image.open(os.path.join(os.path.dirname(os.path.realpath(__file__)),"background.png"))) + @pyqtSlot(str, list) @@ -41,7 +46,8 @@ class Worker(QtCore.QObject): width = int(self.core.settings.value('outputWidth')) height = int(self.core.settings.value('outputHeight')) - frame = Image.new("RGBA", (width, height),(0,0,0,0)) + frame = copy(self.background) + frame = frame.resize((width,height)) components = nextPreviewInformation["components"] for component in reversed(components): diff --git a/video_thread.py b/video_thread.py index ac4162c..e880263 100644 --- a/video_thread.py +++ b/video_thread.py @@ -63,10 +63,16 @@ class Worker(QtCore.QObject): self.bgI += 1 def previewDispatch(self): + background = Image.new("RGBA", (1920, 1080),(0,0,0,0)) + background.paste(Image.open(os.path.join(os.path.dirname(os.path.realpath(__file__)), "background.png"))) + background = background.resize((self.width, self.height)) + while not self.stopped: i = self.previewQueue.get() if time.time() - self.lastPreview >= 0.06 or i[0] == 0: - self._image = ImageQt(i[1]) + image = copy(background) + image = Image.alpha_composite(image, i[1]) + self._image = ImageQt(image) self.imageCreated.emit(QtGui.QImage(self._image)) self.lastPreview = time.time() -- cgit v1.2.3