Uploaded image for project: 'Commons Imaging'
  1. Commons Imaging
  2. IMAGING-234

Unable to get ImageMetadata from JPEG file

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.0-alpha1
    • None
    • Format: JPEG
    • None

    Description

      Imaging.getMetadata() API is failing for JPEG image file (see attached)

      Error message:

      07-25 12:06:54.034 4495 4660 W ExifHelper: Error getting exif metadata from 20190725_114523_t.jpg 
      07-25 12:06:54.040 4495 4660 W ExifHelper: Exception: java.io.IOException: Not a Valid TIFF File
      

       

      Code:

      try {
          Map params = new HashMap(); 
          params.put(ImagingConstants.PARAM_KEY_READ_THUMBNAILS, Boolean.FALSE); 
          params.put(ImagingConstants.PARAM_KEY_STRICT, Boolean.FALSE); 
          ImageMetadata metadata = Imaging.getMetadata(jpegFile); 
          JpegImageMetadata jpegMetadata = (JpegImageMetadata) metadata; 
          if (jpegMetadata != null) {
              return jpegMetadata.getExif();
          }
      } catch (Exception e) { 
          Log.w(TAG, "Error getting exif metadata from " + jpegFile.getAbsolutePath());
          Log.w(TAG, "Exception: " + e); 
      }
      

       

      jhove output:

      ❯ ./jhove 20190725_102443_t.jpg 
      Jhove (Rel. 1.22.1, 2019-04-17)
      Date: 2019-07-25 11:54:41 
      EDT RepresentationInformation: 20190725_102443_t.jpg
      ReportingModule: BYTESTREAM, Rel. 1.4 (2018-10-01) 
      LastModified: 2019-07-25 10:27:40 EDT Size: 18212 
      Format: bytestream 
      Status: Well-Formed and valid 
      SignatureMatches: JPEG-hul MIMEtype: application/octet-stream
      

       

      exiftool output:

      ❯ exiftool -api validate=2 20190725_102443_t.jpg
      ExifTool Version Number : 11.50
      File Name : 20190725_102443_t.jpg
      Directory : .
      File Size : 18 kB
      File Modification Date/Time : 2019:07:25 10:27:40-04:00
      File Access Date/Time : 2019:07:25 11:31:49-04:00
      File Inode Change Date/Time : 2019:07:25 10:27:40-04:00
      File Permissions : rw-r--r--
      File Type : JPEG
      File Type Extension : jpg
      MIME Type : image/jpeg
      Exif Byte Order : Big-endian (Motorola, MM)
      Image Description : shawty snappppp
      X Resolution : 72
      Y Resolution : 72
      Resolution Unit : inches
      Y Cb Cr Positioning : Centered
      Exif Version : 0210
      Components Configuration : Y, Cb, Cr, -
      Flashpix Version : 0100
      Color Space : Uncalibrated
      Exif Image Width : 0
      Exif Image Height : 0
      Image Width : 423
      Image Height : 238
      Encoding Process : Baseline DCT, Huffman coding
      Bits Per Sample : 8
      Color Components : 3
      Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2)
      Image Size : 423x238
      Megapixels : 0.101

       

      Attachments

        1. 20190725_102443_t.jpg
          18 kB
          Michelle Cabahug

        Activity

          People

            Unassigned Unassigned
            mcabahug27 Michelle Cabahug
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: