dramp77 commited on
Commit
9365d5e
1 Parent(s): fd5b433

change fit margin image

Browse files
Files changed (1) hide show
  1. app.py +1 -1
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 if size_align == "Center" else 0 if size_align == "Top" else target_size[1] - image.height
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