Binarizing a picture to the terminal in python. An open source project that others can feel free to use.
1: Open up binarize.py
2: Go to the terminal and change to the directory in which 'binarize.py' is stored
3: Paste the following input: binarize('trump.jpg') A binarized version of Trump will appear. Note that 'trump.jpg' is located in the 'Binarize' folder.
4: You may add any images into the folder and place it into binarize() to binarize those images.
5: Note that the two pre-set images - trump.jpg and clinton.jpg - are adjusted to 200 by 150 pixels so that it will work within the constraints of your terminal.
6: You may add threshold values (100-200 recommended) as another input when you run binarize(). You may also add strings such as 'PP' and 'XI' to replace the preset 'XX' and ' '. When replacing all presets, binarize should be formatted as such: binarize('clinton.jpg', 130, 'PP', 'XI')
Have fun! @Lawrence Mao, 2017