mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix: Handle cases where tile size > image size
This commit is contained in:
parent
0363a06963
commit
51451cbf21
@ -578,11 +578,14 @@ class ColorMapImageProcessorInvocation(ImageProcessorInvocation):
|
|||||||
image = np.array(image, dtype=np.uint8)
|
image = np.array(image, dtype=np.uint8)
|
||||||
height, width = image.shape[:2]
|
height, width = image.shape[:2]
|
||||||
|
|
||||||
|
width_tile_size = min(self.color_map_tile_size, width)
|
||||||
|
height_tile_size = min(self.color_map_tile_size, height)
|
||||||
|
|
||||||
color_map = cv2.resize(
|
color_map = cv2.resize(
|
||||||
image,
|
image,
|
||||||
(width // self.color_map_tile_size, height // self.color_map_tile_size),
|
(width // width_tile_size, height // height_tile_size),
|
||||||
interpolation=cv2.INTER_CUBIC,
|
interpolation=cv2.INTER_CUBIC,
|
||||||
)
|
)
|
||||||
color_map = cv2.resize(color_map, (width, height), interpolation=cv2.INTER_NEAREST)
|
color_map = cv2.resize(color_map, (width, height), interpolation=cv2.INTER_NEAREST)
|
||||||
color_map = Image.fromarray(color_map)
|
color_map = Image.fromarray(color_map)
|
||||||
return color_map
|
return color_map
|
||||||
|
Loading…
Reference in New Issue
Block a user