Spaces:
Runtime error
Runtime error
Pil image format added
Browse files
app.py
CHANGED
|
@@ -21,13 +21,20 @@ def merge_images(image1, image2, method="concatenate"):
|
|
| 21 |
# img1 = cv2.resize(image1, (512,512))
|
| 22 |
# img2 = cv2.resize(image2, (512,512))
|
| 23 |
# img = img1*0.5 + img2*0.5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
|
|
|
|
|
|
| 29 |
|
| 30 |
-
return
|
| 31 |
|
| 32 |
#attribute add
|
| 33 |
# Allow selection of merge method with a dropdown
|
|
|
|
| 21 |
# img1 = cv2.resize(image1, (512,512))
|
| 22 |
# img2 = cv2.resize(image2, (512,512))
|
| 23 |
# img = img1*0.5 + img2*0.5
|
| 24 |
+
|
| 25 |
+
# img1 = image1.astype('float32')
|
| 26 |
+
# img2 = image2.astype('float32')
|
| 27 |
+
# img = 0.5*img1 + 0.5*img2
|
| 28 |
+
# img = img.astype('uint8')
|
| 29 |
|
| 30 |
+
image1 = image1.resize((426, 240))
|
| 31 |
+
image1_size = image1.size
|
| 32 |
+
image2_size = image2.size
|
| 33 |
+
new_image = Image.new('RGB',(2*image1_size[0], image1_size[1]), (250,250,250))
|
| 34 |
+
new_image.paste(image1,(0,0))
|
| 35 |
+
new_image.paste(image2,(image1_size[0],0))
|
| 36 |
|
| 37 |
+
return new_image
|
| 38 |
|
| 39 |
#attribute add
|
| 40 |
# Allow selection of merge method with a dropdown
|