JavaでExifの回転情報を取得する

https://code.google.com/p/metadata-extractor/

を使用します。

  public static int getOrientation(java.io.File in)
      throws IOException, MetadataException, ImageProcessingException {
    try {
      Metadata metadata = ImageMetadataReader.readMetadata(in);
      Directory directory = metadata.getDirectory(ExifIFD0Directory.class);
      JpegDirectory jpegDirectory = metadata.getDirectory(JpegDirectory.class);

      int orientation = 1;
      try {
        orientation = directory.getInt(ExifIFD0Directory.TAG_ORIENTATION);
      } catch (MetadataException me) {

      }

      return orientation;
    } catch (Exception e) {

    }
    return null;
  }