Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. from PIL import Image
  2.  
  3. image_original = Image.open('kSZzc.png')
  4. image_gray = image_original.convert("L") # Convert to grayscale image
  5. image_gray_bw = image_gray.point(lambda pixel: 0 if pixel<128 else 255) # convert to binary image
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement