Created
November 25, 2018 04:58
-
-
Save Deepayan137/18d9d9a2250aa17f79714a085800c80d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import os | |
import sys | |
from tqdm import * | |
def convert(**kwargs): | |
dirname = kwargs['dir_'] | |
savedir = kwargs['save'] | |
image_paths = list(map(lambda f: dirname +'/'+f , os.listdir(dirname))) | |
for path in tqdm(image_paths): | |
image = cv2.imread(path) | |
imagename = os.path.basename(path).split('.tif')[0] | |
savepath = os.path.join(savedir, '{}.jpg'.format(imagename)) | |
cv2.imwrite(savepath, image) | |
print('Done') | |
if __name__ =='__main__': | |
dir_ = sys.argv[1] | |
save = sys.argv[2] | |
convert(dir_=dir_, save=save) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment