1import cv2, os
2base_path = "data/images/"
3new_path = "data/ims/"
4for infile in os.listdir(base_path):
5 print ("file : " + infile)
6 read = cv2.imread(base_path + infile)
7 outfile = infile.split('.')[0] + '.jpg'
8 cv2.imwrite(new_path+outfile,read,[int(cv2.IMWRITE_JPEG_QUALITY), 200])
9