Skip to content

Commit 81df8e6

Browse files
authored
Create qrj.py
1 parent f9d48b5 commit 81df8e6

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

moumoubaimifan/qrj/qrj.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from PIL import Image
2+
3+
xin_img = Image.open('xx.png')
4+
w ,y = xin_img.size
5+
xin = xin_img.resize((w, w),Image.BILINEAR)
6+
7+
border = 15
8+
img_new = Image.new('RGB', (w + 2 * border, w + 2 * border), (255,255,255))
9+
img_new.paste(xin, (border, border), xin)
10+
xin = img_new.convert('RGBA')
11+
w, y = xin.size
12+
xin.show()
13+
14+
points = [(0, 0), (w, 0), (2 * w, 0), (0, w),(w,w),(2 * w,w),(0, 2 * w),(w,2 * w),(2 * w,2 * w)]
15+
16+
imgs=[(6,8,9),(4,6,7,8,9),(4,7,8),(1,2,3,4,5,6,8,9),(1,2,3,4,5,6,7,8,9),(1,2,3,4,5,6,7,8),(3 , -1),(1,2,3,4,5,6,8),(1, -1)]
17+
18+
file_name = 0
19+
for img in imgs:
20+
bgimg=Image.new("RGB",(w * 3,w * 3), (255,255,255))
21+
for item in img:
22+
if(item == -1):
23+
continue
24+
bgimg.paste(xin, points[item - 1], xin)
25+
26+
file_name = file_name + 1
27+
bgimg.save(f"{file_name}.png")

0 commit comments

Comments
 (0)