Python USES pil to convert images to black and white
- 2020-04-02 14:41:42
- OfStack
This example shows how python USES pil to convert images to black and white. Share with you for your reference. Specific analysis is as follows:
Pil is powerful, and the convert method makes it easy to convert images. The code below converts images to black and white
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')
I hope this article has helped you with your Python programming.