Skip to content

Instantly share code, notes, and snippets.

@qingswu
qingswu / png2jpg.py
Last active October 26, 2022 14:05
Convert all png images in current folder to jpg using OpenCV cv2
#!/usr/bin/env python
from glob import glob
import cv2
pngs = glob('./*.png')
for j in pngs:
img = cv2.imread(j)
cv2.imwrite(j[:-3] + 'jpg', img)