]> git.parisson.com Git - timeside.git/commitdiff
fix(render_analyzers) : fix blending of background image
authorThomas Fillon <thomas@parisson.com>
Sat, 21 Jun 2014 07:29:06 +0000 (09:29 +0200)
committerThomas Fillon <thomas@parisson.com>
Sat, 21 Jun 2014 07:29:06 +0000 (09:29 +0200)
timeside/grapher/render_analyzers.py

index 54dc46ec838ce55970adf4a921d16f5b5e06a889..3ba9414dfad2b0faa506b379b341e7cdd801ed7e 100644 (file)
@@ -62,10 +62,14 @@ class DisplayAnalyzer(Grapher):
             bg_result = self.process_pipe.results[self._bg_id]
             bg_image = bg_result._render_PIL((self.image_width,
                                               self.image_height), self.dpi)
-            bg_image.paste(fg_image, (0, 0), fg_image)
-            self.image = bg_image
-        else:
-            self.image = fg_image
+            # convert image to grayscale
+            bg_image = bg_image.convert('LA').convert('RGBA')
+
+            # Merge background and foreground images
+            from PIL.Image import blend
+            fg_image = blend(fg_image, bg_image, 0.25)
+
+        self.image = fg_image
 
     @classmethod
     def create(cls, analyzer, result_id, grapher_id, grapher_name,