change fit margin image
Browse files
app.py
CHANGED
@@ -42,7 +42,7 @@ def change_size(image, selected_size, size_align):
|
|
42 |
|
43 |
# Calculate offset based on alignment choice
|
44 |
x_offset = (target_size[0] - image.width) // 2 if size_align == "Center" else 0 if size_align == "Left" else target_size[0] - image.width
|
45 |
-
y_offset = (target_size[1] - image.height) // 2
|
46 |
|
47 |
new_image.paste(image, (x_offset, y_offset))
|
48 |
|
|
|
42 |
|
43 |
# Calculate offset based on alignment choice
|
44 |
x_offset = (target_size[0] - image.width) // 2 if size_align == "Center" else 0 if size_align == "Left" else target_size[0] - image.width
|
45 |
+
y_offset = (target_size[1] - image.height) // 2 # this to keep the image on center
|
46 |
|
47 |
new_image.paste(image, (x_offset, y_offset))
|
48 |
|