#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import sys
from PIL import Image
def main(target_npy):
im = np.load(target_npy)
print(im)
print('----')
im = im * 0.1
print(im)
pil_img = Image.fromarray(im)
pil_img = pil_img.convert("RGB")
pil_img.save('out.jpg')
if __name__ == '__main__':
if len(sys.argv) == 2:
main(sys.argv[1])
else:
print("usage.")
print("{filename} <target_npy(ex:img_xxx.npy)>"
.format(filename=sys.argv[0]))
Last active
December 20, 2018 00:53
-
-
Save 3panda/ca695c80b831526e2a355d32aa857781 to your computer and use it in GitHub Desktop.
16bitのndarrayファイルを画像に変換して書き出す
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment