Skip to content

Commit 4424e5c

Browse files
committed
Apply black formatting to gif_generator.py
1 parent f4d4137 commit 4424e5c

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/gif_generator.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,21 +141,31 @@ def run_simulation_and_generate_gif(
141141
print(f"Simulation complete. Captured {len(frames)} frames.")
142142

143143
# Generate animation file
144-
if filename.endswith('.gif'):
144+
if filename.endswith(".gif"):
145145
# For GIF, create MP4 first then convert
146-
mp4_path = output_path / filename.replace('.gif', '.mp4')
146+
mp4_path = output_path / filename.replace(".gif", ".mp4")
147147
gif_path = output_path / filename
148148

149149
print(f"Creating MP4: {mp4_path}")
150150
media.write_video(str(mp4_path), frames, fps=framerate)
151151

152152
print(f"Converting to GIF: {gif_path}")
153153
import subprocess
154+
154155
try:
155-
subprocess.run([
156-
'ffmpeg', '-i', str(mp4_path), '-vf',
157-
'fps=10,scale=320:-1:flags=lanczos', '-y', str(gif_path)
158-
], check=True, capture_output=True)
156+
subprocess.run(
157+
[
158+
"ffmpeg",
159+
"-i",
160+
str(mp4_path),
161+
"-vf",
162+
"fps=10,scale=320:-1:flags=lanczos",
163+
"-y",
164+
str(gif_path),
165+
],
166+
check=True,
167+
capture_output=True,
168+
)
159169

160170
print(f"GIF generated successfully: {gif_path}")
161171
return gif_path

0 commit comments

Comments
 (0)