Created
February 21, 2016 23:24
-
-
Save Khalian/c9aee1d5a7f577908a0a to your computer and use it in GitHub Desktop.
A script to convert colored images to black and white
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
from PIL import Image | |
import sys | |
if (len(sys.argv) < 3): | |
print "Usage : python black_and_white.py inputFile outputFile" | |
sys.exit(0) | |
image_file = Image.open(sys.argv[1]) # open colour image | |
image_file = image_file.convert('1') # convert image to black and white | |
image_file.save(sys.argv[2]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment