1import os, sys
2from PIL import Image
3
4for infile in sys.argv[1:]:
5 f, e = os.path.splitext(infile)
6 outfile = f + ".jpg"
7 if infile != outfile:
8 try:
9 with Image.open(infile) as im:
10 im.save(outfile)
11 except OSError:
12 print("cannot convert", infile)
13
1import os, sys
2from PIL import Image
3
4for infile in sys.argv[1:]:
5 f, e = os.path.splitext(infile)
6 outfile = f + ".jpg"
7 if infile != outfile:
8 try:
9 with Image.open(infile) as im:
10 im.save(outfile)
11 except OSError:
12 print("cannot convert", infile)
13