Created
July 12, 2020 15:01
-
-
Save ixnisarg/100e93c7738cec6ba0b2b4d7d32273da to your computer and use it in GitHub Desktop.
This Python file converts JPEG to PNG image format.
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 sys | |
import os | |
from PIL import Image | |
#Directorry input and output | |
image_folder = sys.argv[1] | |
output_folder = sys.argv[2] | |
#check if putput is exist | |
if not os.path.exists(output_folder): | |
os.makedirs(output_folder) | |
for files in os.listdir(image_folder): | |
img = Image.open(f'{image_folder}{files}') | |
clean_name = os.path.splitext((files)) | |
img.save(f'{output_folder}{clean_name}.png','png') | |
print('All Done !!') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Need to added resize and thumbnail options