MynooMuz commited on
Commit
6254392
·
1 Parent(s): fdae55a

chore: update output filename format

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -61,12 +61,18 @@ def process_files(file_objs, strength):
61
  img = Image.open(file_path)
62
  normal_map = process_image(img, strength)
63
 
64
- out_name = f"normal_{file_name}"
65
- if not out_name.lower().endswith('.png'):
66
- out_name = os.path.splitext(out_name)[0] + '.png'
67
 
68
  out_path = os.path.join(temp_dir, out_name)
69
- normal_map.save(out_path, format="PNG")
 
 
 
 
 
 
 
70
  zipf.write(out_path, arcname=out_name)
71
  except Exception as e:
72
  print(f"Hata ({file_path}): {e}")
 
61
  img = Image.open(file_path)
62
  normal_map = process_image(img, strength)
63
 
64
+ base_name, ext = os.path.splitext(file_name)
65
+ out_name = f"{base_name}_normalmap{ext}"
 
66
 
67
  out_path = os.path.join(temp_dir, out_name)
68
+ # Orijinal uzantıya göre kaydetmeye çalış, hata olursa PNG yap
69
+ try:
70
+ normal_map.save(out_path)
71
+ except:
72
+ out_name = f"{base_name}_normalmap.png"
73
+ out_path = os.path.join(temp_dir, out_name)
74
+ normal_map.save(out_path, format="PNG")
75
+
76
  zipf.write(out_path, arcname=out_name)
77
  except Exception as e:
78
  print(f"Hata ({file_path}): {e}")