Created
June 22, 2020 13:11
-
-
Save alik472/a52160e9fb655f50a3449a2df618078b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from PIL import Image | |
files = os.listdir('.') | |
for f in files: | |
first_name = (f[:6]) | |
last_name = (f[-4:]) | |
jpg_name = '.PNG' | |
full_name = first_name + last_name | |
try: | |
im = Image.open(full_name) | |
im.save(first_name.upper() + jpg_name.upper(), "PNG") | |
except: | |
print(full_name) | |
continue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
import os
files = os.listdir('.')
for f in files:
newname = f.upper()
if newname == f:
continue
if newname in files:
print( "error: %s already exists" % newname )
os.rename(f, newname)