AshWu03 commited on
Commit
efdedf4
·
1 Parent(s): cde5c42
Files changed (1) hide show
  1. app.py +7 -10
app.py CHANGED
@@ -28,17 +28,14 @@ def mosiac(input_img):
28
  #resizing the image
29
  if width != height:
30
  if width < height:
31
- #make height the same as width
32
- box = (0, 0, width, width)
33
  elif height < width:
34
- #make width the same as height
35
- box = (0, 0, height, height)
36
- pil_img = pil_img.crop(box)
37
-
38
- width, height = pil_img.size
39
- dims = np.pow(np.floor(np.sqrt(np.sqrt(width))), 4)
40
- box = (0, 0, dims, dims)
41
- cropped_original = pil_img.crop(box)
42
  pil_img = cropped_original.copy()
43
 
44
  quant_img = pil_img.quantize(colors = 100)
 
28
  #resizing the image
29
  if width != height:
30
  if width < height:
31
+ #make the dimensions the width
32
+ dims = np.pow(np.floor(np.sqrt(np.sqrt(width))), 4)
33
  elif height < width:
34
+ #make dimensions the height
35
+ dims = np.pow(np.floor(np.sqrt(np.sqrt(height))), 4)
36
+ dims = int(dims)
37
+ box = (dims, dims)
38
+ cropped_original = pil_img.resize(box)
 
 
 
39
  pil_img = cropped_original.copy()
40
 
41
  quant_img = pil_img.quantize(colors = 100)