1
0
Fork 0

apply lint

This commit is contained in:
Sean Sube 2023-06-03 20:35:33 -05:00
parent ec8f367316
commit 55e5f73d20
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
2 changed files with 24 additions and 14 deletions

View File

@ -114,7 +114,9 @@ def blend_inpaint(
return result.images[0] return result.images[0]
output = process_tile_order(stage.tile_order, source, SizeChart.auto, 1, [outpaint], overlap=params.overlap) output = process_tile_order(
stage.tile_order, source, SizeChart.auto, 1, [outpaint], overlap=params.overlap
)
logger.info("final output image size: %s", output.size) logger.info("final output image size: %s", output.size)
return output return output

View File

@ -61,12 +61,12 @@ def get_tile_grads(
def blend_tiles( def blend_tiles(
tiles: List[Tuple[int, int, Image.Image]], tiles: List[Tuple[int, int, Image.Image]],
scale: int, scale: int,
width: int, width: int,
height: int, height: int,
tile: int, tile: int,
overlap: float, overlap: float,
): ):
adj_tile = int(float(tile) * overlap) adj_tile = int(float(tile) * overlap)
scaled_size = (height * scale, width * scale, 3) scaled_size = (height * scale, width * scale, 3)
@ -98,12 +98,18 @@ def blend_tiles(
scaled_right = min(scaled_left + equalized.shape[1], scaled_size[1]) scaled_right = min(scaled_left + equalized.shape[1], scaled_size[1])
# accumulation # accumulation
value[ value[scaled_top:scaled_bottom, scaled_left:scaled_right, :] += equalized[
scaled_top : scaled_bottom, scaled_left : scaled_right, : 0 : scaled_bottom - scaled_top, 0 : scaled_right - scaled_left, :
] += equalized[0 : scaled_bottom - scaled_top, 0 : scaled_right - scaled_left, :] ]
count[ count[scaled_top:scaled_bottom, scaled_left:scaled_right, :] += np.repeat(
scaled_top : scaled_bottom, scaled_left : scaled_right, : mask[
] += np.repeat(mask[0 : scaled_bottom - scaled_top, 0 : scaled_right - scaled_left, np.newaxis], 3, axis=2) 0 : scaled_bottom - scaled_top,
0 : scaled_right - scaled_left,
np.newaxis,
],
3,
axis=2,
)
pixels = np.where(count > 0, value / count, value) pixels = np.where(count > 0, value / count, value)
return Image.fromarray(pixels) return Image.fromarray(pixels)
@ -169,7 +175,9 @@ def process_tile_spiral(
tile_coords = generate_tile_spiral(width, height, tile, overlap=overlap) tile_coords = generate_tile_spiral(width, height, tile, overlap=overlap)
for left, top in tile_coords: for left, top in tile_coords:
counter += 1 counter += 1
logger.debug("processing tile %s of %s, %sx%s", counter, len(tile_coords), left, top) logger.debug(
"processing tile %s of %s, %sx%s", counter, len(tile_coords), left, top
)
tile_image = image.crop((left, top, left + tile, top + tile)) tile_image = image.crop((left, top, left + tile, top + tile))
tile_image = complete_tile(tile_image, tile) tile_image = complete_tile(tile_image, tile)