-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_gif.py
33 lines (27 loc) · 922 Bytes
/
make_gif.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""
Michael Patel
April 2020
Project description:
Build a GAN to create basketball shoe designs
File description:
For generating a gif of training epochs
"""
################################################################################
# Imports
import os
import glob
import imageio
################################################################################
# Main
if __name__ == "__main__":
# ----- VISUALIZATION ----- #
results_dir = input("Enter images directory: ")
gif_filename = os.path.join(os.getcwd(), "results\\training.gif")
# get all images
image_files_pattern = results_dir + "\\*.png"
filenames = glob.glob(image_files_pattern)
# write all images to gif
with imageio.get_writer(gif_filename, mode="I", fps=1.0) as writer: # 'I' for multiple images
for f in filenames:
image = imageio.imread(f)
writer.append_data(image)