1from scipy.misc import imread, imsave, imresize
2image = imread(f_name)
3if(len(image.shape)<3):
4 print 'gray'
5elif len(image.shape)==3:
6 print 'Color(RGB)'
7else:
8 print 'others'
9
1import cv2
2file = "myFile.jpj"
3
4
5image = cv2.imread(file)
6if image.any() != None:
7 if(len(image.shape)<2):
8 print ('grayscale')
9 elif len(image.shape)==3:
10 print ('Colored')
11else:
12 print("cannot find image")
13