Spaces:
Running
on
Zero
Running
on
Zero
Fix white patch to not apply on aligned side
Browse files
app.py
CHANGED
@@ -126,10 +126,21 @@ def prepare_image_and_mask(image, width, height, overlap_percentage, resize_opti
|
|
126 |
|
127 |
# Calculate overlap areas
|
128 |
white_gaps_patch = 2
|
|
|
129 |
left_overlap = margin_x + overlap_x if overlap_left else margin_x + white_gaps_patch
|
130 |
right_overlap = margin_x + new_width - overlap_x if overlap_right else margin_x + new_width - white_gaps_patch
|
131 |
top_overlap = margin_y + overlap_y if overlap_top else margin_y + white_gaps_patch
|
132 |
bottom_overlap = margin_y + new_height - overlap_y if overlap_bottom else margin_y + new_height - white_gaps_patch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
|
134 |
# Draw the mask
|
135 |
mask_draw.rectangle([
|
|
|
126 |
|
127 |
# Calculate overlap areas
|
128 |
white_gaps_patch = 2
|
129 |
+
|
130 |
left_overlap = margin_x + overlap_x if overlap_left else margin_x + white_gaps_patch
|
131 |
right_overlap = margin_x + new_width - overlap_x if overlap_right else margin_x + new_width - white_gaps_patch
|
132 |
top_overlap = margin_y + overlap_y if overlap_top else margin_y + white_gaps_patch
|
133 |
bottom_overlap = margin_y + new_height - overlap_y if overlap_bottom else margin_y + new_height - white_gaps_patch
|
134 |
+
|
135 |
+
if alignment == "Left":
|
136 |
+
left_overlap = margin_x + overlap_x if overlap_left else margin_x
|
137 |
+
elif alignment == "Right":
|
138 |
+
right_overlap = margin_x + new_width - overlap_x if overlap_right else margin_x + new_width
|
139 |
+
elif alignment == "Top":
|
140 |
+
top_overlap = margin_y + overlap_y if overlap_top else margin_y
|
141 |
+
elif alignment == "Bottom":
|
142 |
+
bottom_overlap = margin_y + new_height - overlap_y if overlap_bottom else margin_y + new_height
|
143 |
+
|
144 |
|
145 |
# Draw the mask
|
146 |
mask_draw.rectangle([
|