diff --git a/oxtimelines/timeline.py b/oxtimelines/timeline.py index 7cfe1b6..3b8b0ec 100644 --- a/oxtimelines/timeline.py +++ b/oxtimelines/timeline.py @@ -304,7 +304,7 @@ class Timelines(): self.frame_center = int(frame_size[0] / 2) self.large_tile_n = int(math.ceil(self.frame_n / self.large_tile_w)) - self.large_tile_last_w = self.frame_n % self.large_tile_w + self.large_tile_last_w = self.frame_n % self.large_tile_w or self.large_tile_w if self.render_small_tiles: self.small_tile_n = int(math.ceil(self.duration / self.small_tile_w)) self.small_tile_last_w =int(math.ceil(self.duration % self.small_tile_w)) @@ -413,7 +413,8 @@ class Timelines(): self._render_keyframes() self.cut_frames.append(frame_image) if self.is_last_frame: - self.cuts.append(self.frame_n) + if not self.cuts or self.cuts[-1] != self.frame_n: + self.cuts.append(self.frame_n) self._render_keyframes() # save large tile @@ -439,8 +440,9 @@ class Timelines(): wide = 1 if mode == 'keyframes' else self.wide frame_ratio = self.frame_ratio * wide cut_images = int(math.ceil(cut_width / (frame_ratio * self.large_tile_h))) - if cut_width == cut_images == 0: + if cut_images == 0: print 'ERROR division by zerro', cut_width, cut_images + index = -1 image_widths = self._divide(cut_width, cut_images) image_i = self.cuts[-2] large_keyframes_tile_i = self.large_keyframes_tile_i @@ -473,8 +475,9 @@ class Timelines(): self.large_tile_image[mode] = Image.new('RGB', (w, self.large_tile_h)) self.large_tile_image[mode].paste(frame_image, (offset, 0)) image_i += image_w - if self.is_last_frame: + if self.is_last_frame and index > -1: self._save_tile(mode, index) + self.large_keyframes_tile_i = large_keyframes_tile_i self.cut_frames = [] self.log and self.profiler.unset_task()