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

Upload pixelation.py

Browse files
Files changed (1) hide show
  1. pixelation.py +2 -2
pixelation.py CHANGED
@@ -2,7 +2,7 @@ from PIL import Image
2
  import numpy as np
3
  from collections import Counter
4
 
5
- def pixelate_image(image, pixel_size, interpolation):
6
  """
7
  对图像进行像素化。
8
 
@@ -19,7 +19,7 @@ def pixelate_image(image, pixel_size, interpolation):
19
 
20
  # 获取原图像的尺寸
21
  width, height = img.size
22
- pixel_size = round(min(width,height)/1024)*pixel_size
23
 
24
  # 选择插值方式
25
  if interpolation == "Nearest":
 
2
  import numpy as np
3
  from collections import Counter
4
 
5
+ def pixelate_image(image, pixel_size, interpolation="Nearest"):
6
  """
7
  对图像进行像素化。
8
 
 
19
 
20
  # 获取原图像的尺寸
21
  width, height = img.size
22
+ pixel_size = pixel_size
23
 
24
  # 选择插值方式
25
  if interpolation == "Nearest":