how to save the color graph n open cv
import cv2
#Reading images in color and grayscale
color_img = cv2.imread('cat.jpeg')
gray_img = cv2.imread('cat.jpeg',0)
#Displaying the image
cv2.imshow('Cat image', color_img)
#Storing the key pressed by user
k = cv2.waitKey(0)
#Check if user hits ‘c’ or ‘g’ key
if( k == ord('c') ):
cv2.imwrite('color.jpg', color_img )
print("Image is saved color")
cv2.destroyAllWindows()
if( k == ord('g') ):
cv2.imwrite('gray.jpg', gray_img )
print("Image saved in grayscale")
cv2.destroyAllWindows()