pil image to grayscale code example
Example 1: imshow grayscale
plt.imshow(im, cmap='gray')
Example 2: convert image to grayscale opencv
img = cv2.imread(path)
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
Example 3: pillow rgb to grayscale
Image.open(path).convert('LA')
Example 4: python pil to greyscale
#PIL image
img2 = img.convert('L')