You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Paul Hartmann (JIRA)" <ji...@apache.org> on 2016/02/03 01:29:39 UTC
[jira] [Created] (IMAGING-180) strange offset of first Exif IFD
value
Paul Hartmann created IMAGING-180:
-------------------------------------
Summary: strange offset of first Exif IFD value
Key: IMAGING-180
URL: https://issues.apache.org/jira/browse/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 value.
The following snippet is used to add the GPS metainfo:
{code:java}
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);
}
}
{code}
Running {{jhead}} on the output file produces a warning:
{code}
$ jhead IMG_7250_small-output.JPG
Nonfatal Error : 'IMG_7250_small-output.JPG' Suspicious offset of first Exif IFD value
{code}
Indeed, the offset should normally be 8 (as in the input file) but is 0x4a=74:
{code}
$ 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.....]
{code}
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
(v6.3.4#6332)