Identifying Color on a Page

Hi Guru's,

I am using COM in most of what I do and I convert pages to both TIFF and JPEG.  I would like to automate this a little further as follows:

By default, I would like to extract all pages to TIFF, but if a page has some color on it, I would like that page to be exported as JPEG.  Is there anyway of identifying whether a page is all black & white or greyscale or if it contains colour and then extracting to the appropriate format.