kd5678 commited on
Commit
f13a446
1 Parent(s): 8414dd2

Update generate_dataset.py

Browse files
Files changed (1) hide show
  1. generate_dataset.py +8 -4
generate_dataset.py CHANGED
@@ -4,18 +4,22 @@ from PIL import Image
4
 
5
 
6
 
7
- def merge_images_horizontally(img1, img2):
8
 
 
 
 
 
9
  img1_width, img1_height = img1.size
10
  img2_width, img2_height = img2.size
11
 
12
  merged_width = img1_width + img2_width
13
  merged_height = max(img1_height, img2_height)
14
- merged_image = Image.new('RGBA', (merged_width + 20, merged_height))
15
 
16
 
17
- merged_image.paste(img1, (0, 0))
18
- merged_image.paste(img2, (img1_width + 20, 0))
19
 
20
  return merged_image
21
 
 
4
 
5
 
6
 
7
+ def merge_images_horizontally(img1, img2, logo_path):
8
 
9
+ logo = Image.open(logo_path)
10
+ logo = logo.resize((100, 20))
11
+ img2.paste(logo, (0, 0))
12
+
13
  img1_width, img1_height = img1.size
14
  img2_width, img2_height = img2.size
15
 
16
  merged_width = img1_width + img2_width
17
  merged_height = max(img1_height, img2_height)
18
+ merged_image = Image.new('RGBA', (merged_width + 60, merged_height))
19
 
20
 
21
+ merged_image.paste(img1, (15, 0))
22
+ merged_image.paste(img2, (img1_width + 30, 0))
23
 
24
  return merged_image
25