Created
February 6, 2018 21:17
-
-
Save jimfilippou/0239ab41182b54da64b712cae125dec1 to your computer and use it in GitHub Desktop.
Convert all PNGs to JPGs in current directory faaaaaaaast
This file contains hidden or 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 | |
if __name__ == '__main__': | |
for subdir, dirs, files in os.walk(os.getcwd()): | |
for file in files: | |
x = os.path.join(subdir, file) | |
if x.endswith("png"): | |
# Convert image | |
print "Converting {}".format(x) | |
os.system("convert {0} {1}".format(x, x.replace("png","jpg"))) | |
print "Deleting {}".format(x) | |
os.system("rm {}".format(x)) | |
else: | |
print "Encountered unknown file" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment