Created
May 11, 2022 05:48
-
-
Save harendra21/9325fcb4aa797338163dd424ee2e2d9d 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 sys | |
from PIL import Image | |
from PIL.ExifTags import TAGS | |
image_file = sys.argv[1] | |
image_name = image_file.split(".")[0] | |
try: | |
image = Image.open(image_file) | |
except IOError: | |
print("Error in loading image!!") | |
sys.exit(1) | |
bw_image = image.convert('L') | |
bw_image.save("bw_"+image_name+".png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment