jhj0517 commited on
Commit
88d3da9
1 Parent(s): 1c3a875

Add image save function

Browse files
Files changed (1) hide show
  1. modules/utils.py +8 -1
modules/utils.py CHANGED
@@ -1,8 +1,15 @@
1
  import os
 
 
2
 
3
 
4
  def open_folder(folder_path: str):
5
  if os.path.exists(folder_path):
6
  os.system(f'start "" "{folder_path}"')
7
  else:
8
- print(f"The folder '{folder_path}' does not exist.")
 
 
 
 
 
 
1
  import os
2
+ from PIL import Image
3
+ import numpy as np
4
 
5
 
6
  def open_folder(folder_path: str):
7
  if os.path.exists(folder_path):
8
  os.system(f'start "" "{folder_path}"')
9
  else:
10
+ print(f"The folder '{folder_path}' does not exist.")
11
+
12
+
13
+ def save_image(image_numpy: np.ndarray, output_path: str):
14
+ image = Image.fromarray(image_numpy)
15
+ image.save(output_path, "JPEG")