Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
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".