summaryrefslogtreecommitdiff
path: root/renderer.py
diff options
context:
space:
mode:
Diffstat (limited to 'renderer.py')
-rw-r--r--renderer.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/renderer.py b/renderer.py
new file mode 100644
index 0000000..98b32f5
--- /dev/null
+++ b/renderer.py
@@ -0,0 +1,32 @@
+#!/bin/python
+
+### very slow step that will be assigned to multiple
+### jobs later in the development of this tool
+
+### data loading
+
+import numpy as np
+
+image_array = np.load("images.npy", allow_pickle=True)
+
+### progress bar
+
+from tqdm import tqdm
+
+pbar = tqdm(total = len(image_array))
+
+### rendering of images
+
+import matplotlib.pyplot as plt
+
+def render(index):
+ name = 'Output/neural_art_{:04d}.png'.format(index + 1)
+
+ plt.axis('off')
+ plt.imshow(image_array[index])
+ plt.savefig(name, dpi=258, bbox_inches='tight', pad_inches=0) # dpi 258 -> 720p ; dpi 387 -> 1080p output image resolution
+ plt.close('all')
+
+for index in range(0, len(image_array)):
+ render(index)
+ pbar.update(1)