1import cv2
2
3image = cv2.imread('C:/Users/N/Desktop/Test.jpg')
4gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
5
6cv2.imshow('Original image',image)
7cv2.imshow('Gray image', gray)
8
9cv2.waitKey(0)
10cv2.destroyAllWindows()
11
1from PIL import Image
2img = Image.open('image.png').convert('LA')
3img.save('greyscale.png')