Spaces:
Running
on
Zero
Running
on
Zero
Commit
•
7f2fa42
1
Parent(s):
1cf8250
Update app.py
Browse files
app.py
CHANGED
@@ -22,15 +22,12 @@ def can_expand(source_width, source_height, target_width, target_height, alignme
|
|
22 |
def prepare_image_and_mask(image, width, height, overlap_percentage, resize_option, custom_resize_percentage, alignment, overlap_left, overlap_right, overlap_top, overlap_bottom):
|
23 |
target_size = (width, height)
|
24 |
|
25 |
-
# Calculate the scaling factor to fit the image within the target size
|
26 |
scale_factor = min(target_size[0] / image.width, target_size[1] / image.height)
|
27 |
new_width = int(image.width * scale_factor)
|
28 |
new_height = int(image.height * scale_factor)
|
29 |
|
30 |
-
# Resize the source image to fit within target size
|
31 |
source = image.resize((new_width, new_height), Image.LANCZOS)
|
32 |
|
33 |
-
# Apply resize option using percentages
|
34 |
if resize_option == "Full":
|
35 |
resize_percentage = 100
|
36 |
elif resize_option == "75%":
|
|
|
22 |
def prepare_image_and_mask(image, width, height, overlap_percentage, resize_option, custom_resize_percentage, alignment, overlap_left, overlap_right, overlap_top, overlap_bottom):
|
23 |
target_size = (width, height)
|
24 |
|
|
|
25 |
scale_factor = min(target_size[0] / image.width, target_size[1] / image.height)
|
26 |
new_width = int(image.width * scale_factor)
|
27 |
new_height = int(image.height * scale_factor)
|
28 |
|
|
|
29 |
source = image.resize((new_width, new_height), Image.LANCZOS)
|
30 |
|
|
|
31 |
if resize_option == "Full":
|
32 |
resize_percentage = 100
|
33 |
elif resize_option == "75%":
|