diff --git a/invokeai/backend/tiles/tiles.py b/invokeai/backend/tiles/tiles.py index 1948f6624e..cdc94bf760 100644 --- a/invokeai/backend/tiles/tiles.py +++ b/invokeai/backend/tiles/tiles.py @@ -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