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

strange offset of first Exif IFD value

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Format: JPEG
    • None

    Description

      Adding GPS coordinates to a jpeg image creates a file with strange offset of first Exif IFD value.

      The following snippet is used to add the GPS metainfo:

          public static void main(String[] args) throws Exception {
              final File inFile = new File("IMG_7250_small.JPG");
              File outFile = new File("IMG_7250_small-output.JPG");
              final TiffImageMetadata exif = ((JpegImageMetadata) Imaging.getMetadata(inFile)).getExif();
              final TiffOutputSet outputSet = exif.getOutputSet();
              outputSet.setGPSInDegrees(123, 34);
              try (BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(outFile))) {
                  new ExifRewriter().updateExifMetadataLossless(inFile, os, outputSet);
              }
          }
      

      Running jhead on the output file produces a warning:

      $ jhead IMG_7250_small-output.JPG
      Nonfatal Error : 'IMG_7250_small-output.JPG' Suspicious offset of first Exif IFD value
      

      Indeed, the offset should normally be 8 (as in the input file) but is 0x4a=74:

      $ exiftool -v3 IMG_7250_small-output.JPG
      [...]
      JPEG APP1 (258 bytes):
          0006: 45 78 69 66 00 00 49 49 2a 00 4a 00 00 00 05 00 [Exif..II*.J.....]
      

      As far as I can tell, this offset is useless, wastes space and possibly breaks software that relies on the standard value "8".

      Attachments

        1. IMG_7250_small.JPG
          93 kB
          Paul Hartmann

        Activity

          People

            Unassigned Unassigned
            bastik Paul Hartmann
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: