Spaces:
Running
Running
trying like this
Browse files
app.py
CHANGED
|
@@ -49,12 +49,13 @@ def overlay_png_on_side_by_side_images(
|
|
| 49 |
img1 = Image.fromarray(person_image_path).convert("RGBA")
|
| 50 |
img2 = insect_image_path.convert("RGBA")
|
| 51 |
png_img = Image.open(overlay_image_path).convert("RGBA")
|
| 52 |
-
|
| 53 |
-
# Determine a common height for side-by-side images
|
| 54 |
min_height = 3600
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
| 58 |
combined_width = img1.width + img2.width
|
| 59 |
# Create a blank canvas for the combined image
|
| 60 |
|
|
|
|
| 49 |
img1 = Image.fromarray(person_image_path).convert("RGBA")
|
| 50 |
img2 = insect_image_path.convert("RGBA")
|
| 51 |
png_img = Image.open(overlay_image_path).convert("RGBA")
|
|
|
|
|
|
|
| 52 |
min_height = 3600
|
| 53 |
+
img1_hpercent = (min_height / float(img1.size[1]))
|
| 54 |
+
img1_wsize = int((float(img1.size[0) * float(img1_hpercent)))
|
| 55 |
+
img2_hpercent = (min_height / float(img2.size[1]))
|
| 56 |
+
img2_wsize = int((float(img2.size[0) * float(img2_hpercent)))
|
| 57 |
+
img1 = img1.resize((img1_wsize, min_height), Image.LANCZOS)
|
| 58 |
+
img2 = img2.resize((img2_wsize, min_height), Image.LANCZOS)
|
| 59 |
combined_width = img1.width + img2.width
|
| 60 |
# Create a blank canvas for the combined image
|
| 61 |
|