python 图片tif转jpg或png

  • Post author:
  • Post category:python


import cv2

import os

tif_path = ”

jpg_path = ”

imgs = os.listdir(tif_path)

for i, img in enumerate(imgs):

img_name = os.path.join(tif_path, img)

file = cv2.imread(img_name, 1)

save_file = os.path.join(jpg_path, img.strip(‘.tif’)+’.jpg’)

cv2.imwrite(save_file, file)

print(i)



版权声明:本文为u012759006原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。