commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Hartmann (JIRA)" <>
Subject [jira] [Created] (IMAGING-180) strange offset of first Exif IFD value
Date Wed, 03 Feb 2016 00:29:39 GMT
Paul Hartmann created IMAGING-180:

             Summary: strange offset of first Exif IFD value
                 Key: IMAGING-180
             Project: Commons Imaging
          Issue Type: Bug
          Components: Format: JPEG
            Reporter: Paul Hartmann

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

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".

This message was sent by Atlassian JIRA

View raw message