monkseal555 commited on
Commit
4d161ff
·
verified ·
1 Parent(s): 59b93e6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -63,7 +63,7 @@ def resize_image(image, output_size=(1024, 1024)):
63
  if image_aspect > target_aspect:
64
  # Resize the image to match the target height, maintaining aspect ratio
65
  new_height = output_size[1]
66
- new_width = int(new_height * image_aspect)
67
  resized_image = image.resize((new_width, new_height), Image.LANCZOS)
68
  # Calculate coordinates for cropping
69
  left = (new_width - output_size[0]) / 2
@@ -72,7 +72,7 @@ def resize_image(image, output_size=(1024, 1024)):
72
  bottom = output_size[1]
73
  else:
74
  # Resize the image to match the target width, maintaining aspect ratio
75
- new_width = output_size[0]
76
  new_height = int(new_width / image_aspect)
77
  resized_image = image.resize((new_width, new_height), Image.LANCZOS)
78
  # Calculate coordinates for cropping
 
63
  if image_aspect > target_aspect:
64
  # Resize the image to match the target height, maintaining aspect ratio
65
  new_height = output_size[1]
66
+ new_width = int(new_height * image_aspect)/2
67
  resized_image = image.resize((new_width, new_height), Image.LANCZOS)
68
  # Calculate coordinates for cropping
69
  left = (new_width - output_size[0]) / 2
 
72
  bottom = output_size[1]
73
  else:
74
  # Resize the image to match the target width, maintaining aspect ratio
75
+ new_width = output_size[0]/2
76
  new_height = int(new_width / image_aspect)
77
  resized_image = image.resize((new_width, new_height), Image.LANCZOS)
78
  # Calculate coordinates for cropping