Skip to content

Instantly share code, notes, and snippets.

@dexhunter
Forked from qingswu/png2jpg.py
Created August 8, 2017 08:56
Show Gist options
  • Save dexhunter/60fcc4464da98232840c514338b44242 to your computer and use it in GitHub Desktop.
Save dexhunter/60fcc4464da98232840c514338b44242 to your computer and use it in GitHub Desktop.
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment