Skip to content

Instantly share code, notes, and snippets.

@ixnisarg
Created July 12, 2020 15:01
Show Gist options
  • Save ixnisarg/100e93c7738cec6ba0b2b4d7d32273da to your computer and use it in GitHub Desktop.
Save ixnisarg/100e93c7738cec6ba0b2b4d7d32273da to your computer and use it in GitHub Desktop.
This Python file converts JPEG to PNG image format.
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 !!')
@ixnisarg
Copy link
Author

Need to added resize and thumbnail options

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