sasha HF Staff commited on
Commit
37e9f21
·
1 Parent(s): 2a60395

what happened here

Browse files
Files changed (1) hide show
  1. app.py +2 -27
app.py CHANGED
@@ -53,33 +53,8 @@ def overlay_png_on_side_by_side_images(
53
  # Determine a common height for side-by-side images
54
  min_height = 5400
55
  # Resize images to the common height, maintaining aspect ratio
56
- img1 = img1.resize((3600 / 2, 5400), Image.LANCZOS)
57
- img2 = img2.resize((3600 / 2, 5400), Image.LANCZOS)
58
- combined_width = img1.width + img2.width
59
- # Create a blank canvas for the combined image
60
-
61
- combined_image = Image.new(
62
- "RGBA", (combined_width, min_height), (0, 0, 0, 0)
63
- ) # Transparent background
64
-
65
- # Paste images side by side
66
- combined_image.paste(img1, (0, 0))
67
- combined_image.paste(img2, (img1.width, 0))
68
-
69
- # Resize PNG to fit within the combined image dimensions if necessary, or to a desired size
70
- # For simplicity, let's resize the PNG to a quarter of the combined image's width, maintaining aspect ratio
71
- target_png_width = combined_image.width
72
- png_img = png_img.resize((combined_image.width, min_height), Image.LANCZOS)
73
-
74
- # Overlay the PNG image
75
- combined_image.paste(png_img, png_position, png_img)
76
-
77
- # Save the result
78
- # Determine a common height for side-by-side images
79
- min_height = 384
80
- # Resize images to the common height, maintaining aspect ratio
81
- img1 = img1.resize((288, 384), Image.LANCZOS)
82
- img2 = img2.resize((288, 384), Image.LANCZOS)
83
  combined_width = img1.width + img2.width
84
  # Create a blank canvas for the combined image
85
 
 
53
  # Determine a common height for side-by-side images
54
  min_height = 5400
55
  # Resize images to the common height, maintaining aspect ratio
56
+ img1 = img1.resize((1800, 5400), Image.LANCZOS)
57
+ img2 = img2.resize((1800, 5400), Image.LANCZOS)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  combined_width = img1.width + img2.width
59
  # Create a blank canvas for the combined image
60