Huxxshadow commited on
Commit
5a4d80a
·
verified ·
1 Parent(s): 317facf

Upload pixelation.py

Browse files
Files changed (1) hide show
  1. 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":