Skip to content

Instantly share code, notes, and snippets.

@qingswu
Last active October 26, 2022 14:05
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save qingswu/1a58c9d66dfc0a6aaac45528bbe01b82 to your computer and use it in GitHub Desktop.
Save qingswu/1a58c9d66dfc0a6aaac45528bbe01b82 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)
@ACMOIDRE
Copy link

Capture
Capture2
Capture3

this are strange effect after running scripts

@ACMOIDRE
Copy link

ACMOIDRE commented Oct 14, 2020

I think first image conversion has error other are fine atleast to my eye vision.
if any one notices difference in below images too , plz kindly report by commenting.
thank you in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment