soiz commited on
Commit
f0c236a
·
verified ·
1 Parent(s): 4f05095

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -28,15 +28,18 @@ def edit_file(file, loop_count, speed_factor, frame_skip):
28
  frames.append(frame.copy())
29
  durations.append(original_duration // speed_factor) # 再生速度調整
30
 
31
- # メタデータリセット&保存
 
 
 
32
  output_path = f"{base_name}_edited.gif"
33
  frames[0].save(
34
  output_path,
35
  save_all=True,
36
  append_images=frames[1:],
37
- loop=loop_count, # ループ回数(0は無限ループ、1は1回ループ)
38
  duration=durations,
39
- disposal=2 # 各フレームを上書きする設定
40
  )
41
 
42
  return output_path, output_path
 
28
  frames.append(frame.copy())
29
  durations.append(original_duration // speed_factor) # 再生速度調整
30
 
31
+ # ループ回数の調整
32
+ adjusted_loop_count = max(0, loop_count - 1) # GIFのループ設定に合わせる
33
+
34
+ # 保存
35
  output_path = f"{base_name}_edited.gif"
36
  frames[0].save(
37
  output_path,
38
  save_all=True,
39
  append_images=frames[1:],
40
+ loop=adjusted_loop_count, # 調整後のループ回数
41
  duration=durations,
42
+ disposal=2
43
  )
44
 
45
  return output_path, output_path