code: public void checkImage(IFD ifd, int n, IfdTags metadata) {
      CheckCommonFields(ifd, n, metadata);
  
      if (!metadata.containsTagId(TiffTags.getTagId("PhotometricInterpretation"))) {
        validation.addErrorLoc("Missing Photometric Interpretation", "IFD" + n);
      } else if (metadata.get(TiffTags.getTagId("PhotometricInterpretation")).getValue().size() != 1) {
        validation.addErrorLoc("Invalid Photometric Interpretation", "IFD" + n);
      } else {
        photometric =
            (int) metadata.get(TiffTags.getTagId("PhotometricInterpretation")).getFirstNumericValue();
        switch (photometric) {
          case 0:
          case 1:
            if (!metadata.containsTagId(TiffTags.getTagId("BitsPerSample"))
                || metadata.get(TiffTags.getTagId("BitsPerSample")).getFirstNumericValue() == 1) {
              type = ImageType.BILEVEL;
              CheckBilevelImage(metadata, n);
            } else {
              type = ImageType.GRAYSCALE;
              CheckGrayscaleImage(metadata, n);
            }
            break;
          case 2:
            type = ImageType.RGB;
            CheckRGBImage(metadata, n);
            break;
          case 3:
            type = ImageType.PALETTE;
            CheckPalleteImage(metadata, n);
            break;
          case 4:
            type = ImageType.TRANSPARENCY_MASK;
            CheckTransparencyMask(metadata, n);
            break;
          case 5:
            type = ImageType.CMYK;
            CheckCMYK(metadata, n);
            break;
          case 6:
            type = ImageType.YCbCr;
            CheckYCbCr(metadata, n);
            break;
          case 8:
          case 9:
          case 10:
            type = ImageType.CIELab;
            CheckCIELab(metadata, n);
            break;
          default:
            validation.addWarning("Unknown Photometric Interpretation", "" + photometric, "IFD" + n);
            break;
        }
      }
    }
docs: Check if the tags that define the image are correct and consistent.
  
  @param ifd the ifd
  @param n the ifd number
  @param metadata the ifd metadata