fix for calc_tiles_min_overlap when tile size is bigger than image size

This commit is contained in:
skunkworxdark 2023-12-12 13:40:28 +00:00 committed by Kent Keirsey
parent 6caa70123d
commit dd7deff1a3

View File

@ -191,7 +191,14 @@ def calc_tiles_min_overlap(
assert min_overlap < tile_height
assert min_overlap < tile_width
# The If Else catches the case when the tile size is larger than the images size and just clips the number of tiles to 1
# catches the cases when the tile size is larger than the images size and just clips the number of tiles to 1
if image_width < tile_width:
tile_width = image_width
if image_height < tile_height:
tile_height = image_height
num_tiles_x = math.ceil((image_width - min_overlap) / (tile_width - min_overlap)) if tile_width < image_width else 1
num_tiles_y = (
math.ceil((image_height - min_overlap) / (tile_height - min_overlap)) if tile_height < image_height else 1