from PIL import Image
image_file = Image.open("convert_image.png") # open colour image
image_file = image_file.convert('1') # convert image to black and white
image_file.save('result.png')
yields
More Related Contents:
- How to install PIL with pip on Mac OS?
- How to update the image of a Tkinter Label widget?
- python tkinter how to bind key to a button
- Remove string in python dictionary value
- Swapping variable places inside if throws an error
- Export a list of stock prices to excel
- Text parsing and retrieval
- Check if the element is last in the list
- What’s wrong with my Python 2 program?
- How do you send a HEAD HTTP request in Python 2?
- Python Image Library fails with message “decoder JPEG not available” – PIL
- Removing unicode \u2026 like characters in a string in python2.7 [duplicate]
- Getting only element from a single-element list in Python?
- Unable to install Python packages using pip in Ubuntu Linux: InsecurePlatformWarning, SSLError, tlsv1 alert protocol version
- Python: Exporting environment variables in subprocess.Popen(..)
- Convert RGB to black OR white
- Merging dataframes based on date range
- Reading XML file and fetching its attributes value in Python
- Unexpected IndexError while removing list items [duplicate]
- Can’t create pdf using python PDFKIT Error : ” No wkhtmltopdf executable found:”
- Switch between python 2.7 and python 3.5 on Mac OS X
- How to modify the default font in Tkinter?
- creating a spiral array in python?
- Python returns length of 2 for single Unicode character string
- Getting “cannot write mode P as JPEG” while operating on JPG image
- How to create a new text file using Python
- Decoding base64 from POST to use in PIL
- Python: How to resize an image using PIL module
- Python not able to open file with non-english characters in path
- How to fix TypeError: ‘int’ object is not subscriptable