Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -23,25 +23,26 @@ def init():
|
|
23 |
crop()
|
24 |
|
25 |
def crop():
|
26 |
-
|
27 |
import generator
|
28 |
res = 64
|
29 |
if res != 0:
|
30 |
results = "generated.png"
|
31 |
img = Image.open(results)
|
32 |
|
33 |
-
width,height = img.size
|
34 |
-
|
35 |
|
36 |
top = 2
|
37 |
bottom = 2
|
38 |
for i in range(4):
|
39 |
-
left = (res+2)*i +2
|
40 |
-
right = width-(res+2)*i
|
41 |
-
imgcrop = img.crop((left,top,left+res,res+2
|
42 |
|
|
|
|
|
43 |
|
44 |
-
imgcrop.save(str(i)+".png")
|
|
|
45 |
init()
|
46 |
|
47 |
|
|
|
23 |
crop()
|
24 |
|
25 |
def crop():
|
|
|
26 |
import generator
|
27 |
res = 64
|
28 |
if res != 0:
|
29 |
results = "generated.png"
|
30 |
img = Image.open(results)
|
31 |
|
32 |
+
width, height = img.size
|
|
|
33 |
|
34 |
top = 2
|
35 |
bottom = 2
|
36 |
for i in range(4):
|
37 |
+
left = (res + 2) * i + 2
|
38 |
+
right = width - (res + 2) * i
|
39 |
+
imgcrop = img.crop((left, top, left + res, top + res)) # Changed res+2 to res
|
40 |
|
41 |
+
# Resize the image using nearest neighbor interpolation
|
42 |
+
imgcrop = imgcrop.resize((res, res), Image.NEAREST)
|
43 |
|
44 |
+
imgcrop.save(str(i) + ".png")
|
45 |
+
|
46 |
init()
|
47 |
|
48 |
|