diff options
| -rw-r--r-- | photoblaster/modules/pbconcat/__init__.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/photoblaster/modules/pbconcat/__init__.py b/photoblaster/modules/pbconcat/__init__.py index e9bc671..21ef89b 100644 --- a/photoblaster/modules/pbconcat/__init__.py +++ b/photoblaster/modules/pbconcat/__init__.py @@ -75,8 +75,14 @@ class PbConcat(ModuleBase): return frames def _match_dimensions(self): + """acts on image_url2 only""" dimensions1 = self.params.img_url1.get_file().get_dimensions() dimensions2 = self.params.img_url2.get_file().get_dimensions() + if "jpg" in self.params.finalformat: + self._add_canvas( + self.params.img_url2.get_file(), + canvas_color="white" + ) if self.params.mode == "append" and \ dimensions1[1] != dimensions2[1]: self.params.img_url2.get_file().resize( @@ -152,10 +158,6 @@ class PbConcat(ModuleBase): return frames[0:frame_number] def create(self): - if self.params.finalformat == "jpg": - for imageparam in [self.params.img_url1, self.params.img_url2]: - if getattr(imageparam, "mimetype") in ["gif", "png"]: - self._add_canvas(imageparam.get_file()) self._match_dimensions() file_created = self._merge_frames( self.params.img_url1.get_file(), @@ -167,8 +169,7 @@ class PbConcat(ModuleBase): ) super(PbConcat, self).create() - def _add_canvas(self, image): - """maybe remove""" + def _add_canvas(self, image, canvas_color="transparent"): canvasfile = File( is_temp=True, extension="jpg", @@ -178,7 +179,7 @@ class PbConcat(ModuleBase): BIN_CONVERT, "-size", "x".join(image.get_dimensions()), - "xc:transparent", + "xc:%s" % canvas_color, canvasfile.get_filepath()]) self._call_cmd(cmd) self._files_created.append(canvasfile) |
