Python Image Library (PIL) is a library that provides support for opening, manipulating, and saving many different image file formats. Here is how you can check whether a JPEG image is color or grayscale using PIL:
```python import Image im = Image.open("lena.jpg") if im.mode == "RGB": print("Color Image") else: print("Grayscale Image") ```The im.mode
attribute returns the mode of the image. For color images, the mode will be "RGB". For grayscale images, the mode will be "L".