Skip to content

Instantly share code, notes, and snippets.

@kweralt
Forked from qingswu/png2jpg.py
Last active June 4, 2020 07:56
Show Gist options
  • Save kweralt/65a8608e797162658f033b20d39eaf22 to your computer and use it in GitHub Desktop.
Save kweralt/65a8608e797162658f033b20d39eaf22 to your computer and use it in GitHub Desktop.
Convert all png images in current folder to jpg using OpenCV cv2
import glob
import cv2
imagefiles = glob.glob('C:/Users/kwe/Downloads/Resized DW Images/**/*.png', recursive=True)
for i in imagefiles:
img = cv2.imread(i)
cv2.imwrite(i[:-3] + 'jpg', img)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment