|
@@ -0,0 +1,17 @@
|
|
1
|
+from PIL import Image
|
|
2
|
+
|
|
3
|
+infile = "ja.PNG"
|
|
4
|
+chopsize = 300
|
|
5
|
+
|
|
6
|
+img = Image.open(infile)
|
|
7
|
+width, height = img.size
|
|
8
|
+
|
|
9
|
+# Save Chops of original image
|
|
10
|
+for x0 in range(0, width, chopsize):
|
|
11
|
+ for y0 in range(0, height, chopsize):
|
|
12
|
+ box = (x0, y0,
|
|
13
|
+ x0+chopsize if x0+chopsize < width else width - 1,
|
|
14
|
+ y0+chopsize if y0+chopsize < height else height - 1)
|
|
15
|
+ print('%s %s' % (infile, box))
|
|
16
|
+ img.crop(box).save('C:\\Users\\tobby48\\Desktop\\지문자\\zchop.%s.x%03d.y%03d.jpg' % (infile.replace('.jpg',''), x0, y0))
|
|
17
|
+
|