binarize image python code example
Example 1: python resize image
from PIL import Image
image = Image.open("path/.../image.png")
image = image.resize((500,500),Image.ANTIALIAS)
image.save(fp="newimage.png")
Example 2: convert image to binary python
img=cv2.imread('<image path>')
gray_img=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)