/**
   * According to the Exif Version 2.2 standard:
   *
   * <p>1 = The 0th row is at the visual top of the image, and the 0th column is the visual
   * left-hand side. 2 = The 0th row is at the visual top of the image, and the 0th column is the
   * visual right-hand side. 3 = The 0th row is at the visual bottom of the image, and the 0th
   * column is the visual right-hand side. 4 = The 0th row is at the visual bottom of the image, and
   * the 0th column is the visual left-hand side. 5 = The 0th row is the visual left-hand side of
   * the image, and the 0th column is the visual top. 6 = The 0th row is the visual right-hand side
   * of the image, and the 0th column is the visual top. 7 = The 0th row is the visual right-hand
   * side of the image, and the 0th column is the visual bottom. 8 = The 0th row is the visual
   * left-hand side of the image, and the 0th column is the visual bottom. Other = reserved
   *
   * @param imageFile
   * @param img
   * @return
   */
  private BufferedImage rotateAccordingToExif(File imageFile, BufferedImage img) {
    int rotationAccordingToExif;

    switch (MetaDataUtil.getOrientationTag(imageFile)) {
      case 1:
        rotationAccordingToExif = 0;
        break;
      case 2:
        return img;
      case 3:
        rotationAccordingToExif = 180;
        break;
      case 4:
        return img;
      case 5:
        return img;
      case 6:
        rotationAccordingToExif = 90;
        break;
      case 7:
        return img;
      case 8:
        rotationAccordingToExif = 270;
        break;
      default:
        return img;
    }

    return rotateImageAccordingToExifAndCurrentGUIRotation(rotationAccordingToExif, img);
  }
Example #2
0
  public void addTableRow(MetaData metaData) {

    String noValue = lang.get("common.missing.value");

    Object[] meta = new Object[9];

    meta[0] = MetaDataUtil.hasValue(metaData.getFileName()) ? metaData.getFileName() : noValue;
    meta[1] =
        MetaDataUtil.hasValue(metaData.getExifDateAsString())
            ? metaData.getExifDateAsString()
            : noValue;
    meta[2] =
        MetaDataUtil.hasValue(metaData.getExifTimeAsString())
            ? metaData.getExifTimeAsString()
            : noValue;
    meta[3] =
        MetaDataUtil.hasValue(metaData.getExifCameraModel())
            ? metaData.getExifCameraModel()
            : noValue;
    meta[4] =
        MetaDataUtil.hasValue(metaData.getExifExposureTime())
            ? metaData.getExifExposureTime()
            : noValue;
    meta[5] =
        MetaDataUtil.hasValue(metaData.getExifISOValue()) ? metaData.getExifISOValue() : noValue;
    meta[6] =
        MetaDataUtil.hasValue(metaData.getExifPictureWidth())
            ? metaData.getExifPictureWidth()
            : noValue;
    meta[7] =
        MetaDataUtil.hasValue(metaData.getExifPictureHeight())
            ? metaData.getExifPictureHeight()
            : noValue;
    meta[8] =
        MetaDataUtil.hasValue(metaData.getExifFNumber()) ? metaData.getExifFNumber() : noValue;

    this.addRow(meta);
  }