code: private int getTagSize(TagValue tag) {
      int n = tag.getCardinality();
      int id = tag.getId();
  
      // Calculate tag size
      int type = tag.getType();
  
      if (id == 330) {
        // SubIFD
        n = 1000;
      }
      if (id == 700) {
        // XMP
        if (tag.getValue().size() > 0)
          n = tag.getValue().get(0).toString().length();
      }
      if (id == 33723) {
        // IPTC
        n = tag.getReadlength();
      }
      if (id == 34665) {
        // EXIF
        n = 1000;
      }
      if (id == 34675) {
        // ICC
        n = tag.getReadlength();
      }
  
      int typeSize = TiffTags.getTypeSize(type);
      int tagSize = typeSize * n;
      return tagSize;
    }
docs: Gets the tag size.
  
  @param tag the tag
  @return the tag size