Ensure all size parameters are integers to prevent type errors

This commit is contained in:
Lex Song
2025-04-02 03:28:58 +08:00
parent b3c56b22bd
commit ede3470260

View File

@@ -413,6 +413,13 @@ def resize_image(image: np.ndarray, width: int, height: int, resized_width: int,
Returns:
image
"""
# Ensure all size parameters are actual integers
width = int(width)
height = int(height)
resized_width = int(resized_width)
resized_height = int(resized_height)
if resize_interpolation is None:
resize_interpolation = "lanczos" if width > resized_width and height > resized_height else "area"