Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -23,26 +23,25 @@ def init():
|
|
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,
|
|
|
33 |
|
34 |
top = 2
|
35 |
bottom = 2
|
36 |
for i in range(4):
|
37 |
-
left = (res
|
38 |
-
right = width
|
39 |
-
imgcrop = img.crop((left,
|
40 |
|
41 |
-
# Resize the image using nearest neighbor interpolation
|
42 |
-
imgcrop = imgcrop.resize((res, res), Image.NEAREST)
|
43 |
|
44 |
-
imgcrop.save(str(i)
|
45 |
-
|
46 |
init()
|
47 |
|
48 |
|
|
|
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 |
|