Package com.drew.metadata.exif

Examples of com.drew.metadata.exif.ExifSubIFDDirectory


            if (date != null) {
                return date;
            }
        }

        ExifSubIFDDirectory subDir = metadata.getDirectory(ExifSubIFDDirectory.class);
        if (subDir != null) {
            date = subDir.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL);
            if (date != null) {
                return date;
            }
        }
View Full Code Here


            jpegDimensionTag = JpegDirectory.TAG_JPEG_IMAGE_HEIGHT;
        } else {
            throw new IllegalArgumentException("dimensionType was not equal to 'HEIGHT' or 'WIDTH'.");
        }

        ExifSubIFDDirectory exifDir = metadata.getDirectory(ExifSubIFDDirectory.class);
        if (exifDir != null) {
                Integer dimension = exifDir.getInteger(exifDimensionTag);
            if (dimension != null && !dimension.equals(0)) {
                return dimension;
            }
        }
View Full Code Here

        assertFalse(new ImageMetadataExtractor.ExifHandler().supports(JpegCommentDirectory.class));
    }
   
    @Test
    public void testExifHandlerParseDate() throws MetadataException {
        ExifSubIFDDirectory exif = mock(ExifSubIFDDirectory.class);
        when(exif.containsTag(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(true);
        when(exif.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(
                new GregorianCalendar(2000, 0, 1, 0, 0, 0).getTime()); // jvm default timezone as in Metadata Extractor
        Metadata metadata = new Metadata();
       
        new ImageMetadataExtractor.ExifHandler().handle(exif, metadata);
        assertEquals("Should be ISO date without time zone", "2000-01-01T00:00:00",
View Full Code Here

      //          cfg.getCtxt().log("" + tag);
      //        }
      //      }
      // retrieve jpeg tags if any
      JpegDirectory jpegDir = metadata.getDirectory(JpegDirectory.class);
      ExifSubIFDDirectory exifDir = metadata.getDirectory(ExifSubIFDDirectory.class);
      try {
        imgData.addParameter(Configuration.heigthParam, jpegDir.getImageHeight());
        imgData.addParameter(Configuration.widthParam, jpegDir.getImageWidth());
      }
      catch (MetadataException ex1) {
        imgData.addParameter(Configuration.heigthParam, exifDir.getInteger(ExifSubIFDDirectory.TAG_EXIF_IMAGE_HEIGHT ));
        imgData.addParameter(Configuration.widthParam, exifDir.getInteger(ExifSubIFDDirectory.TAG_EXIF_IMAGE_WIDTH ));
      }

      //      try {
      //        SimpleDateFormat sdf = new SimpleDateFormat(Configuration.DATE_FORMAT);
      //        if (exifDir != null) {
View Full Code Here

   * @throws ImageProcessingException
   */
  protected java.sql.Date getImgDate(File img, java.sql.Date defaultDate) throws IOException, ImageProcessingException {
    Date imgDate = null;
    Metadata metadata = ImageMetadataReader.readMetadata(img);
    ExifSubIFDDirectory exifDir = metadata.getDirectory(ExifSubIFDDirectory.class);
    try {
      // Try to find a date in image EXIF data,...
      if (exifDir != null) {
        imgDate = exifDir.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL);
        if (imgDate == null) {
          imgDate = exifDir.getDate(ExifSubIFDDirectory.TAG_DATETIME_DIGITIZED);
        }
      }
      // ... or in the image file attributes
      if (imgDate == null) {
        Path path = img.toPath();
View Full Code Here

   * @throws ImageProcessingException
   */
  protected java.sql.Date getImgDate(File img, java.sql.Date defaultDate) throws IOException, ImageProcessingException {
    Date imgDate = null;
    Metadata metadata = ImageMetadataReader.readMetadata(img);
    ExifSubIFDDirectory exifDir = metadata.getDirectory(ExifSubIFDDirectory.class);
    try {
      // Try to find a date in image EXIF data,...
      if (exifDir != null) {
        imgDate = exifDir.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL);
        if (imgDate == null) {
          imgDate = exifDir.getDate(ExifSubIFDDirectory.TAG_DATETIME_DIGITIZED);
        }
      }
      // ... or in the image file attributes
      if (imgDate == null) {
        Path path = img.toPath();
View Full Code Here

      //          cfg.getCtxt().log("" + tag);
      //        }
      //      }
      // retrieve jpeg tags if any
      JpegDirectory jpegDir = metadata.getDirectory(JpegDirectory.class);
      ExifSubIFDDirectory exifDir = metadata.getDirectory(ExifSubIFDDirectory.class);
      try {
        imgData.addParameter(Configuration.heigthParam, jpegDir.getImageHeight());
        imgData.addParameter(Configuration.widthParam, jpegDir.getImageWidth());
      }
      catch (MetadataException ex1) {
        imgData.addParameter(Configuration.heigthParam, exifDir.getInteger(ExifSubIFDDirectory.TAG_EXIF_IMAGE_HEIGHT ));
        imgData.addParameter(Configuration.widthParam, exifDir.getInteger(ExifSubIFDDirectory.TAG_EXIF_IMAGE_WIDTH ));
      }

      //      try {
      //        SimpleDateFormat sdf = new SimpleDateFormat(Configuration.DATE_FORMAT);
      //        if (exifDir != null) {
View Full Code Here

      //          cfg.getCtxt().log("" + tag);
      //        }
      //      }
      // retrieve jpeg tags if any
      JpegDirectory jpegDir = metadata.getDirectory(JpegDirectory.class);
      ExifSubIFDDirectory exifDir = metadata.getDirectory(ExifSubIFDDirectory.class);
      try {
        imgData.addParameter(Configuration.heigthParam, jpegDir.getImageHeight());
        imgData.addParameter(Configuration.widthParam, jpegDir.getImageWidth());
      }
      catch (MetadataException ex1) {
        imgData.addParameter(Configuration.heigthParam, exifDir.getInteger(ExifSubIFDDirectory.TAG_EXIF_IMAGE_HEIGHT ));
        imgData.addParameter(Configuration.widthParam, exifDir.getInteger(ExifSubIFDDirectory.TAG_EXIF_IMAGE_WIDTH ));
      }

      //      try {
      //        SimpleDateFormat sdf = new SimpleDateFormat(Configuration.DATE_FORMAT);
      //        if (exifDir != null) {
View Full Code Here

   * @throws ImageProcessingException
   */
  protected java.sql.Date getImgDate(File img, java.sql.Date defaultDate) throws IOException, ImageProcessingException {
    Date imgDate = null;
    Metadata metadata = ImageMetadataReader.readMetadata(img);
    ExifSubIFDDirectory exifDir = metadata.getDirectory(ExifSubIFDDirectory.class);
    try {
      // Try to find a date in image EXIF data,...
      if (exifDir != null) {
        imgDate = exifDir.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL);
        if (imgDate == null) {
          imgDate = exifDir.getDate(ExifSubIFDDirectory.TAG_DATETIME_DIGITIZED);
        }
      }
      // ... or in the image file attributes
      if (imgDate == null) {
        Path path = img.toPath();
View Full Code Here

      //          cfg.getCtxt().log("" + tag);
      //        }
      //      }
      // retrieve jpeg tags if any
      JpegDirectory jpegDir = metadata.getDirectory(JpegDirectory.class);
      ExifSubIFDDirectory exifDir = metadata.getDirectory(ExifSubIFDDirectory.class);
      try {
        imgData.addParameter(Configuration.heigthParam, jpegDir.getImageHeight());
        imgData.addParameter(Configuration.widthParam, jpegDir.getImageWidth());
      }
      catch (MetadataException ex1) {
        imgData.addParameter(Configuration.heigthParam, exifDir.getInteger(ExifSubIFDDirectory.TAG_EXIF_IMAGE_HEIGHT ));
        imgData.addParameter(Configuration.widthParam, exifDir.getInteger(ExifSubIFDDirectory.TAG_EXIF_IMAGE_WIDTH ));
      }

      //      try {
      //        SimpleDateFormat sdf = new SimpleDateFormat(Configuration.DATE_FORMAT);
      //        if (exifDir != null) {
View Full Code Here

TOP

Related Classes of com.drew.metadata.exif.ExifSubIFDDirectory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.