primerz commited on
Commit
620e64a
·
verified ·
1 Parent(s): bf9d1cc

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +2 -2
utils.py CHANGED
@@ -9,7 +9,7 @@ def resize_image_to_1mp(image):
9
  """Resizes image to approx 1MP (e.g., 1024x1024) preserving aspect ratio."""
10
  image = image.convert("RGB")
11
  w, h = image.size
12
- target_pixels = 768 * 768
13
  aspect_ratio = w / h
14
 
15
  # Calculate new dimensions
@@ -21,6 +21,6 @@ def resize_image_to_1mp(image):
21
  new_h = (new_h // 64) * 64
22
 
23
  if new_w == 0 or new_h == 0:
24
- new_w, new_h = 768, 768 # Fallback
25
 
26
  return image.resize((new_w, new_h), Image.LANCZOS)
 
9
  """Resizes image to approx 1MP (e.g., 1024x1024) preserving aspect ratio."""
10
  image = image.convert("RGB")
11
  w, h = image.size
12
+ target_pixels = 1024 * 1024
13
  aspect_ratio = w / h
14
 
15
  # Calculate new dimensions
 
21
  new_h = (new_h // 64) * 64
22
 
23
  if new_w == 0 or new_h == 0:
24
+ new_w, new_h = 1024, 1024 # Fallback
25
 
26
  return image.resize((new_w, new_h), Image.LANCZOS)