I have some TIFF grayscale images with useless values for ColorMap. The images are grayscale since the value for PhotometricInterpretation is 1 and they have a BitsPerSample value. Pallete images, the only ones that require a ColorMap field, must have a PhotometricInterpretation of 3.
Libtiff is able to read the file, and simply issues a warning about it:
TIFFReadDirectory: Incorrect count for "ColorMap"; tag ignored.
However, GraphicsMagick promotes this warning to an error of the class ErrorCoder which can be caught with GraphicsMagick++:
Magick++ exception: Magick: Incorrect count for "ColorMap"; tag ignored. (TIFFReadDirectory) reported by coders/tiff.c:652 (TIFFErrors)
Even though the error is caught, no image is read. I don't know why the file has a ColorMap since it's not required for this type of image but may be used by specialized software since there's also two private tags in the file (317 and 34362).
This bug can be reproduced with the attached image but not using GraphicsMagick built with quantum depth of 8 (I'm using quantum depth 32), which I'm guessing is because the image has a bitdepth of 16, and the small ColorMap would be enough for it. If that's the case, it would suggest that the ColorMap may be being used incorrectly for non-pallete images.