Spaces:
Sleeping
Sleeping
Upload pixelation.py
Browse files- pixelation.py +1 -1
pixelation.py
CHANGED
|
@@ -19,7 +19,7 @@ def pixelate_image(image, pixel_size, interpolation="Nearest"):
|
|
| 19 |
|
| 20 |
# 获取原图像的尺寸
|
| 21 |
width, height = img.size
|
| 22 |
-
pixel_size = pixel_size
|
| 23 |
|
| 24 |
# 选择插值方式
|
| 25 |
if interpolation == "Nearest":
|
|
|
|
| 19 |
|
| 20 |
# 获取原图像的尺寸
|
| 21 |
width, height = img.size
|
| 22 |
+
pixel_size = max(1, round(min(width, height) / 1024) * pixel_size)
|
| 23 |
|
| 24 |
# 选择插值方式
|
| 25 |
if interpolation == "Nearest":
|