From 72abc8469087bda505d34b42e531a7756245cd1b Mon Sep 17 00:00:00 2001 From: Brian Date: Sun, 4 Oct 2020 18:31:09 +0100 Subject: [PATCH] Attempt to take padding account when calculating output width cell count --- image_assembler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/image_assembler.py b/image_assembler.py index fd58245..3ff5259 100644 --- a/image_assembler.py +++ b/image_assembler.py @@ -15,7 +15,7 @@ class ImageAssembler: self.output = Image.new('RGBA', (metadata['width'], metadata['height']), (255, 255, 255, 0)) # TODO double check this logic - self.output_width_cells = math.ceil(float(metadata['width']) / cell_size) + self.output_width_cells = 1 + math.ceil(float(metadata['width'] - cell_size) / (cell_size - 2*padding)) def atlas_get_cell(self, cell_no: int): cell_x_pos = cell_no % self.atlas_width_cells