Devashishraghav commited on
Commit
e0609d6
·
verified ·
1 Parent(s): 3f4b262

Upload processor/zipper.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. processor/zipper.py +5 -6
processor/zipper.py CHANGED
@@ -10,8 +10,7 @@ def standardize_and_zip(images: List[tuple[str, np.ndarray]]) -> io.BytesIO:
10
  (e.g., 600x800), encodes them as PNG/JPG, and zips them.
11
  Returns an in-memory ZIP file stream.
12
  """
13
- TARGET_WIDTH = 600
14
- TARGET_HEIGHT = 800
15
 
16
  zip_buffer = io.BytesIO()
17
 
@@ -22,12 +21,12 @@ def standardize_and_zip(images: List[tuple[str, np.ndarray]]) -> io.BytesIO:
22
  # Determine orientation to preserve aspect ratio
23
  if w > h:
24
  # Landscape
25
- new_w = 800
26
- new_h = int(h * (800 / w))
27
  else:
28
  # Portrait
29
- new_h = 800
30
- new_w = int(w * (800 / h))
31
 
32
  resized = cv2.resize(img, (new_w, new_h), interpolation=cv2.INTER_CUBIC)
33
 
 
10
  (e.g., 600x800), encodes them as PNG/JPG, and zips them.
11
  Returns an in-memory ZIP file stream.
12
  """
13
+ TARGET_LONG_SIDE = 1200
 
14
 
15
  zip_buffer = io.BytesIO()
16
 
 
21
  # Determine orientation to preserve aspect ratio
22
  if w > h:
23
  # Landscape
24
+ new_w = TARGET_LONG_SIDE
25
+ new_h = int(h * (TARGET_LONG_SIDE / w))
26
  else:
27
  # Portrait
28
+ new_h = TARGET_LONG_SIDE
29
+ new_w = int(w * (TARGET_LONG_SIDE / h))
30
 
31
  resized = cv2.resize(img, (new_w, new_h), interpolation=cv2.INTER_CUBIC)
32