code: public int getMainImagesCount() {
      int count = 0;
      List<TiffObject> list = new ArrayList<>();
      list.addAll(getMetadataList("IFD"));
      list.addAll(getMetadataList("SubIFDs"));
  
      for (TiffObject to : list) {
        if (to instanceof IFD) {
          IFD ifd = (IFD) to;
          if (ifd.isImage() && !ifd.isThumbnail())
            count++;
        }
      }
  
      return count;
    }
docs: Gets the main images count.
  
  @return the ifd count