Answers for "tiff to jpg in python"

0

tiff to jpg in python

import cv2, os
base_path = "data/images/"
new_path = "data/ims/"
for infile in os.listdir(base_path):
    print ("file : " + infile)
    read = cv2.imread(base_path + infile)
    outfile = infile.split('.')[0] + '.jpg'
    cv2.imwrite(new_path+outfile,read,[int(cv2.IMWRITE_JPEG_QUALITY), 200])
Posted by: Guest on September-04-2021

Python Answers by Framework

Browse Popular Code Answers by Language