code: private static Set<String> imageOrientationsOf(ImageMetadata metadata) {
  
      String exifIFD0DirName = new ExifIFD0Directory().getName();
  
      Tag[] tags = Arrays.stream(metadata.getDirectories())
              .filter(dir -> dir.getName().equals(exifIFD0DirName))
              .findFirst()
              .map(Directory::getTags)
              .orElseGet(() -> new Tag[0]);
  
      return Arrays.stream(tags)
              .filter(tag -> tag.getType() == 274)
              .map(Tag::getRawValue)
              .collect(Collectors.toSet());
    }
docs: returns the values of the orientation tag