Attempt to take padding account when calculating output width cell count

This commit is contained in:
2020-10-04 18:31:09 +01:00
parent 84992a4a57
commit 72abc84690

View File

@@ -15,7 +15,7 @@ class ImageAssembler:
self.output = Image.new('RGBA', (metadata['width'], metadata['height']), (255, 255, 255, 0)) self.output = Image.new('RGBA', (metadata['width'], metadata['height']), (255, 255, 255, 0))
# TODO double check this logic # 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): def atlas_get_cell(self, cell_no: int):
cell_x_pos = cell_no % self.atlas_width_cells cell_x_pos = cell_no % self.atlas_width_cells