diff options
author | Vee9ahd1 <[email protected]> | 2019-06-03 12:17:29 -0400 |
---|---|---|
committer | Vee9ahd1 <[email protected]> | 2019-06-03 12:17:29 -0400 |
commit | 69eb6678fc1c61fdb77f84f25f29ba9f777cd3dd (patch) | |
tree | f4320244e50ef7bb6ae34e216d9266f6c67ae1dc /gantools/image_utils.py | |
parent | dcc12c31b79ac9a17738d75adba65556624c412e (diff) |
output directory and file prefix (base name) are now handled by different arguments
Diffstat (limited to 'gantools/image_utils.py')
-rw-r--r-- | gantools/image_utils.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gantools/image_utils.py b/gantools/image_utils.py index 016891f..72130b0 100644 --- a/gantools/image_utils.py +++ b/gantools/image_utils.py @@ -1,10 +1,11 @@ +import os import PIL.Image def save_image(arr, fp, format='JPEG'): image = PIL.Image.fromarray(arr) image.save(fp, format=format, quality=90) -def save_images(ims, path_prefix='', format='JPEG'): +def save_images(ims, output_dir='', prefix='', format='JPEG'): for i, im in enumerate(ims): - path = str(path_prefix)+str(i).zfill(4)+'.'+str(format).lower() - save_image(im, path) + full_path = os.path.join(output_dir, prefix + str(i).zfill(4) + '.' + format.lower()) + save_image(im, full_path, format) |