We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 97fdbdc commit ac573c8Copy full SHA for ac573c8
moumoubaimifan/bdd/wx_bdd.py
@@ -0,0 +1,24 @@
1
+from PIL import Image
2
+import os
3
+
4
+path = 'D:/bdd/'
5
+tx_img = Image.open(os.path.join(path,'tx.jpg'))
6
+bdd_img = Image.open(os.path.join(path,'bdd.png'))
7
8
+tx_rgba = tx_img.convert('RGBA')
9
+bdd_rgba = bdd_img.convert('RGBA')
10
11
+tx_x, tx_y = tx_rgba.size
12
+bdd_x, bdd_y = bdd_rgba.size
13
14
+scale = 5
15
+img_scale = max(tx_x / (scale * bdd_x), tx_y / (scale * bdd_y))
16
+new_size = (int(bdd_x * img_scale), int(bdd_y * img_scale))
17
+bdd = bdd_rgba.resize(new_size, resample=Image.ANTIALIAS)
18
+bdd.show()
19
20
+bdd_x, bdd_y = bdd.size
21
+tx_rgba.paste(bdd, (tx_x - bdd_x, tx_y - bdd_y), bdd)
22
+tx_rgba.show()
23
24
+tx_rgba.save(os.path.join(path,'tx_bdd.png'))
0 commit comments