summaryrefslogtreecommitdiff
path: root/renderer.py
blob: 7eaae9a815f80436484984dc9d43c0015d5e0707 (plain)
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
#!/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, 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)