GNOME Bugzilla – Bug 577933
Incorrect handling of GPS information in EXIF headers of digital photos
Last modified: 2013-10-26 23:24:29 UTC
Please describe the problem: The pictures saved by my digital camera (Nikon D200), fitted with a GPS device, include extensive geographical information in their EXIF headers, including the GPS-determined date and Universal Time (UT), as well as the number of satellites used to determine the position of the camera. If I save the JPEG file under a new name with GIMP, the newly created file lacks a number of GPS fields that were present in the original picture. Demonstration: Here is the GPS information retrieved from an original photo by exiftool (See http://www.sno.phy.queensu.ca/~phil/exiftool/): [michel@Pavilion ~/Photos/Eval_GPS/Public_pics] exiftool dsc_0003.jpg | grep GPS GPS Version ID : 2.2.0.0 GPS Latitude Ref : South GPS Longitude Ref : East GPS Altitude Ref : Above Sea Level GPS Time Stamp : 06:24:57 GPS Satellites : 08 GPS Map Datum : GPS Date Stamp : 2008:04:27 GPS Altitude : 353 m Above Sea Level GPS Date/Time : 2008:04:27 06:24:57 GPS Latitude : 25 deg 1' 10.80" S GPS Longitude : 31 deg 29' 49.20" E GPS Position : 25 deg 1' 10.80" S, 31 deg 29' 49.20" E [michel@Pavilion ~/Photos/Eval_GPS/Public_pics] I re-sized this picture and saved it under a new name, asking for a 60% JPEG compression rate, and here is the GPS content of the new file: [michel@Pavilion ~/Photos/Eval_GPS/Public_pics] exiftool dsc_0003_tiny.jpg | grep GPS GPS Version ID : 2.2.0.0 GPS Latitude Ref : South GPS Longitude Ref : East GPS Altitude Ref : Above Sea Level GPS Altitude : 353 m Above Sea Level GPS Latitude : 25 deg 1' 10.80" S GPS Longitude : 31 deg 29' 49.20" E GPS Position : 25 deg 1' 10.80" S, 31 deg 29' 49.20" E [michel@Pavilion ~/Photos/Eval_GPS/Public_pics] Information about the date, Universal Time and number of satellites are missing. This is particularly unfortunate because the GPS timing information is much more accurate than the approximate setting of the camera. Also, the number of satellites is a critical piece of information to assess the accuracy of the geographical position information. In its current incarnation, GIMP is unsuitable for processing pictures in a scientific or technical context, where the quality, accuracy and reliability of metadata information is essential. Steps to reproduce: 1. Examine GPS information in the EXIF header of an original JPEG picture. 2. Use GIMP to edit and save the picture under a new name. 3. Examine GPS information in the EXIF header of the newly created JPEG file. Actual results: The EXIF header of the files saved by GIMP misses some of the critical GPS information that is present in the original picture, including the date, Universal Time and number of contributing satellites. Expected results: GIMP should not touch or arbitrarily select any of the GPS fields that are present in the original pictures. Timing information from GPS satellites is much more accurate that any manual setting on the camera. Also, the number of contributing satellites is critical to evaluate the accuracy of the GPS information. Does this happen every time? Yes. Other information: I'll be happy to provide you with digital photographs containing GPS information in their headers if you so desire. In this case, let me know where/how I should upload them.
There was bug #377917 about a similar topic.
Hi Michael, Thanks for pointing out this earlier reference. It had not showed up when I searched the bug list, for some reason. I've now read that bug report and the set of subsequent comments at http://bugzilla.gnome.org/show_bug.cgi?id=377917 It appears that problems with preserving the GPS information in EXIF headers have been noted for a long time (at least since November 2006), but only partially addressed since the problem remains. The following questions spring to mind: - Why does GIMP even touch the pre-existing content of the EXIF header? GIMP should preserve the metadata information from the camera and carry it over to the saved file, adding information about GIMP but not removing information generated by other software or by the camera itself. - It's highly likely that Nikon, Canon and many other camera companies) fully comply with (or perhaps even help define) the applicable standards to generate properly formatted EXIF headers. But even if this were not the case, it's not up to GIMP to try to fix the problems of other companies. GIMP users are interested in getting useful results, not in verifying compliance with standards. - Why is this bug still not fixed after 28 months? In case that point has been missed in the technical details of the earlier discussion, let me repeat that GIMP-generated images are not suitable for use in any application that requires accurate information on the date and time when the pictures are taken. That may include law firms and law enforcement institutions relying on an objective and automatic, reliable mechanism for establishing such facts. It is also essential for scientific applications that require an assessment of the accuracy and reliability of the metadata information. For reference, GPS devices for digital cameras will typically report a geographical location to the camera as soon as they can 'lock' on 3 satellites, but the accuracy of that information is highly unreliable. As a scientist, I analyze digital photographs taken in the field and I must have a way to assess whether to trust the information I analyze. I can't do that once the pictures have been touched by GIMP, which means that this software package is useless for such purpose. I'll be more than happy to provide digital photographs containing GPS information, if that can help. Thanks for pushing for a definite solution of this problem. Cheers, Michel.
You should provide a sample image that does contain the full information.
Created attachment 132363 [details] JPEG photo with an EXIF header containing detailed GPS information This picture (compressed by Nikon Capture NX under Windows) is provided in conjunction with a bug report concerning the mis-handling by GIMP of the GPS information in the EXIF header of digital photographs. Suggested test: Open this picture with GIMP, modify it in an arbitrary way and save it under a new name. The EXIF header of the newly saved file has multiple GPS fields missing, including the date, time and the number of satellites contributing to the determination of the location. See accompanying message for more details.
Hi Michael, Thanks a lot for following up on this issue. I tried to append an original JPEG image to this discussion but the upload failed because that image exceeds the 1MB limit on the Bugzilla system. The (automatic) suggestion in the error message is to compress the image and send it again, but of course that is precisely the source of the problem I'm trying to demonstrate... So I copied the file to a Microsoft Windows system, and used the Nikon Capture NX Version 1.1 software package to save a smaller version of that picture. For reference, here is the output of exiftool on the original image: $ exiftool dsc_0003.jpg ExifTool Version Number : 7.70 File Name : dsc_0003.jpg Directory : . File Size : 3.1 MB File Modification Date/Time : 2008:04:27 08:25:00+02:00 File Type : JPEG MIME Type : image/jpeg Exif Byte Order : Big-endian (Motorola, MM) Make : NIKON CORPORATION Camera Model Name : NIKON D200 Orientation : Rotate 90 CW X Resolution : 300 Y Resolution : 300 Resolution Unit : inches Software : Ver.2.00 Modify Date : 2008:04:27 08:24:59 Y Cb Cr Positioning : Co-sited Exposure Time : 1/250 F Number : 8.0 Exposure Program : Program AE ISO : 100 Exif Version : 0221 Date/Time Original : 2008:04:27 08:24:59 Create Date : 2008:04:27 08:24:59 Components Configuration : YCbCr Compressed Bits Per Pixel : 2 Exposure Compensation : 0 Max Aperture Value : 3.5 Metering Mode : Multi-segment Flash : No Flash Focal Length : 18.0 mm Maker Note Version : 2.10 Color Mode : Color Quality : Normal White Balance : Auto Focus Mode : AF-S Flash Setting : Normal Flash Type : White Balance Fine Tune : 0 Color Balance 1 : 1.87890625 1.296875 1 1 Program Shift : 0 Exposure Difference : 0 Compression : JPEG (old-style) Preview Image Start : 3360 Preview Image Length : 23825 Flash Exposure Compensation : 0 ISO Setting : 100 Image Boundary : 0 0 3872 2592 Flash Exposure Bracket Value : 0.0 Exposure Bracket Value : 0 Crop Hi Speed : Off (3904x2616 cropped to 3904x2616 at pixel 0,0) Serial Number : Image Authentication : Off Tone Comp : Auto Lens Type : G VR Lens : 18-200mm f/3.5-5.6 Flash Mode : Did Not Fire AF Area Mode : Dynamic Area AF Point : Center AF Points In Focus : Center Shooting Mode : Continuous, Auto ISO Auto Bracket Release : Manual Release Color Hue : Mode1 Light Source : Natural Shot Info Version : 0207 Vibration Reduction : On (1) Hue Adjustment : 0 Noise Reduction : Off WB RGGB Levels : 481 256 256 332 Lens Data Version : 0201 Exit Pupil Position : 93.1 mm AF Aperture : 3.6 Focus Position : 0xaa Focus Distance : 5.96 m Lens ID Number : 139 Lens F Stops : 5.33 Min Focal Length : 18.3 mm Max Focal Length : 201.6 mm Max Aperture At Min Focal : 3.6 Max Aperture At Max Focal : 5.7 MCU Version : 141 Effective Max Aperture : 3.6 Sensor Pixel Size : 6.05 x 6.05 um Image Data Size : 3206934 Image Count : 3090 Deleted Image Count : 0 Shutter Count : 3090 Flash Info Version : 0101 Flash Model : (none) External Flash Flags : (none) Flash Commander Mode : Off Flash Control Mode : Off Flash Group A Control Mode : Off Flash Group B Control Mode : Off Flash Group A Exposure Comp : 0 Flash Group B Exposure Comp : 0 Image Optimization : Normal Multi Exposure Version : 0100 Multi Exposure Mode : Off Multi Exposure Shots : 0 Multi Exposure Auto Gain : Off High ISO Noise Reduction : Off User Comment : Sub Sec Time : 32 Sub Sec Time Original : 32 Sub Sec Time Digitized : 32 Flashpix Version : 0100 Color Space : sRGB Exif Image Width : 3872 Exif Image Height : 2592 Interoperability Index : R98 - DCF basic file (sRGB) Interoperability Version : 0100 Sensing Method : One-chip color area File Source : Digital Camera Scene Type : Directly photographed CFA Pattern : [Green,Red][Blue,Green] Custom Rendered : Normal Exposure Mode : Auto Digital Zoom Ratio : 1 Focal Length In 35mm Format : 27 mm Scene Capture Type : Standard Gain Control : None Contrast : Normal Saturation : Normal Sharpness : Normal Subject Distance Range : Unknown GPS Version ID : 2.2.0.0 GPS Latitude Ref : South GPS Longitude Ref : East GPS Altitude Ref : Above Sea Level GPS Time Stamp : 06:24:57 GPS Satellites : 08 GPS Map Datum : GPS Date Stamp : 2008:04:27 Thumbnail Offset : 27568 Thumbnail Length : 9613 Image Width : 3872 Image Height : 2592 Encoding Process : Baseline DCT, Huffman coding Bits Per Sample : 8 Color Components : 3 Y Cb Cr Sub Sampling : YCbCr4:2:2 (2 1) Aperture : 8.0 Blue Balance : 1.296875 GPS Altitude : 353 m Above Sea Level GPS Date/Time : 2008:04:27 06:24:57 GPS Latitude : 25 deg 1' 10.80" S GPS Longitude : 31 deg 29' 49.20" E GPS Position : 25 deg 1' 10.80" S, 31 deg 29' 49.20" E Image Size : 3872x2592 Lens ID : AF-S DX VR Zoom-Nikkor 18-200mm f/3.5-5.6G IF-ED Lens : 18-200mm f/3.5-5.6 G VR Preview Image : (Binary data 23825 bytes, use -b option to extract) Red Balance : 1.878906 Scale Factor To 35 mm Equivalent: 1.5 Shutter Speed : 1/250 Create Date : 2008:04:27 08:24:59.32 Date/Time Original : 2008:04:27 08:24:59.32 Modify Date : 2008:04:27 08:24:59.32 Thumbnail Image : (Binary data 9613 bytes, use -b option to extract) Circle Of Confusion : 0.020 mm Depth Of Field : inf (1.51 m - inf) Field Of View : 67.2 deg (7.92 m) Focal Length : 18.0 mm (35 mm equivalent: 27.0 mm) Hyperfocal Distance : 2.02 m Light Value : 14.0 $ and here is the output of exiftool after compression with the Nikon Capture NX Version 1.1: $ exiftool dsc_0003_NX_small.jpg ExifTool Version Number : 7.70 File Name : dsc_0003_NX_small.jpg Directory : . File Size : 795 kB File Modification Date/Time : 2009:04:08 23:28:22+02:00 File Type : JPEG MIME Type : image/jpeg JFIF Version : 1.02 Exif Byte Order : Little-endian (Intel, II) Make : NIKON CORPORATION Camera Model Name : NIKON D200 Orientation : Horizontal (normal) X Resolution : 300 Y Resolution : 300 Resolution Unit : inches Software : Capture NX 1.1.0 W Modify Date : 2009:04:08 23:28:20 Y Cb Cr Positioning : Centered Exposure Time : 1/250 F Number : 8.0 Exposure Program : Program AE ISO : 100 Exif Version : 0220 Date/Time Original : 2008:04:27 08:24:59 Create Date : 2008:04:27 08:24:59 Components Configuration : YCbCr Exposure Compensation : 0 Max Aperture Value : 3.5 Metering Mode : Multi-segment Flash : No Flash Focal Length : 18.0 mm Maker Note Version : 2.10 Color Mode : Color Quality : Normal White Balance : Auto Sharpness : Auto Focus Mode : AF-S White Balance Fine Tune : 0 Color Balance 1 : 1.00390625 4.00390625 0.00390625 0.00390625 Program Shift : 0 Exposure Difference : 0 Compression : JPEG (old-style) Preview Image Start : 3843 Preview Image Length : 12205 ISO Setting : 100 Image Boundary : 0 0 3872 2592 Exposure Bracket Value : 0 Crop Hi Speed : Off (3904x2616 cropped to 3904x2616 at pixel 0,0) Serial Number : Image Authentication : Off Tone Comp : Auto Lens Type : G VR Lens : 18-200mm f/3.5-5.6 Flash Mode : Did Not Fire AF Area Mode : Dynamic Area AF Point : Center AF Points In Focus : Center Shooting Mode : Continuous, Auto ISO Auto Bracket Release : Manual Release Color Hue : Mode1 Light Source : Natural Hue Adjustment : 0 Noise Reduction : Off WB RGGB Levels : 257 1 1 1025 Lens Data Version : 0201 Exit Pupil Position : 93.1 mm AF Aperture : 3.6 Focus Position : 0xaa Focus Distance : 5.96 m Lens ID Number : 139 Lens F Stops : 5.33 Min Focal Length : 18.3 mm Max Focal Length : 201.6 mm Max Aperture At Min Focal : 3.6 Max Aperture At Max Focal : 5.7 MCU Version : 141 Effective Max Aperture : 3.6 Sensor Pixel Size : 6.05 x 6.05 um Image Data Size : 788409 Image Count : 3090 Deleted Image Count : 0 Shutter Count : 3090 Image Optimization : Normal Saturation : Auto Multi Exposure Version : 0100 Multi Exposure Mode : Off Multi Exposure Shots : 0 Multi Exposure Auto Gain : Off High ISO Noise Reduction : Off Nikon Capture Version : Capture NX 1.1.0 W IFD0 Offset : 2512 Preview IFD Offset : 2412 User Comment : Sub Sec Time : 32 Sub Sec Time Original : 32 Sub Sec Time Digitized : 32 Flashpix Version : 0100 Color Space : Uncalibrated Exif Image Width : 2592 Exif Image Height : 3872 Sensing Method : One-chip color area File Source : Digital Camera Scene Type : Directly photographed CFA Pattern : [Green,Red][Blue,Green] GPS Latitude Ref : South GPS Longitude Ref : East GPS Altitude Ref : Above Sea Level GPS Time Stamp : 06:24:57 GPS Satellites : 08 GPS Map Datum : GPS Date Stamp : 2008:04:27 Thumbnail Offset : 2666 Thumbnail Length : 1177 Profile CMM Type : NKON Profile Version : 2.2.0 Profile Class : Display Device Profile Color Space Data : RGB Profile Connection Space : XYZ Profile Date Time : 2002:10:25 13:32:16 Profile File Signature : acsp Primary Platform : Apple Computer Inc. CMM Flags : Not Embedded, Independent Device Manufacturer : none Device Model : Device Attributes : Reflective, Glossy, Positive, Color Rendering Intent : Perceptual Connection Space Illuminant : 0.9642 1 0.82491 Profile Creator : Profile ID : 0 Profile Description : Nikon sRGB 4.0.0.3001 Red Matrix Column : 0.43607 0.2225 0.01392 Green Matrix Column : 0.38507 0.71687 0.09706 Blue Matrix Column : 0.14305 0.06061 0.71399 Media White Point : 0.9505 1 1.0891 Profile Copyright : Nikon Inc. & Nikon Corporation 2002 Red Tone Reproduction Curve : (Binary data 8204 bytes, use -b option to extract) Green Tone Reproduction Curve : (Binary data 8204 bytes, use -b option to extract) Blue Tone Reproduction Curve : (Binary data 8204 bytes, use -b option to extract) Current IPTC Digest : 0390272b7f23c89393f259ea477b47b7 Envelope Record Version : 4 Destination : File Format : No ObjectData File Version : 0 Service Identifier : Envelope Number : Product ID : Envelope Priority : Unknown () Date Sent : Time Sent : Application Record Version : 4 Object Name : Category : Release Date : Release Time : Expiration Date : Expiration Time : Special Instructions : Date Created : Time Created : Originating Program : Program Version : By-line : By-line Title : City : Province-State : Country-Primary Location Code : Country-Primary Location Name : Original Transmission Reference : Headline : Credit : Source : Copyright Notice : Caption-Abstract : Writer-Editor : Language Identifier : Image Width : 2592 Image Height : 3872 Encoding Process : Baseline DCT, Huffman coding Bits Per Sample : 8 Color Components : 3 Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2) Aperture : 8.0 Blue Balance : 1025 Date/Time Created : GPS Altitude : 353 m Above Sea Level GPS Date/Time : 2008:04:27 06:24:57 GPS Latitude : 25 deg 1' 10.80" S GPS Longitude : 31 deg 29' 49.20" E GPS Position : 25 deg 1' 10.80" S, 31 deg 29' 49.20" E Image Size : 2592x3872 Lens ID : AF-S DX VR Zoom-Nikkor 18-200mm f/3.5-5.6G IF-ED Lens : 18-200mm f/3.5-5.6 G VR Preview Image : (Binary data 12205 bytes, use -b option to extract) Red Balance : 257 Shutter Speed : 1/250 Create Date : 2008:04:27 08:24:59.32 Date/Time Original : 2008:04:27 08:24:59.32 Modify Date : 2009:04:08 23:28:20.32 Thumbnail Image : (Binary data 1177 bytes, use -b option to extract) Focal Length : 18.0 mm Light Value : 14.0 $ As you will see, that Nikon software also modifies the EXIF header, but largely by adding fields (or at least offering the opportunity to add new metadata). The basic GPS fields are left untouched and the 'Date stamp', 'Time stamp' and (number of) 'Satellites' used are simply copied over. If the upload worked as expected, the file 'dsc_0003_NX_small.jpg' should be available as an attachment to this discussion. Let me know if you need more pictures to work on. Best personal regards, Michel.
Tested with trunk, and GPS fields seem to be preserved after being saved by gimp. $ grep GPS before GPS Latitude Ref : South GPS Longitude Ref : East GPS Altitude Ref : Above Sea Level GPS Time Stamp : 06:24:57 GPS Satellites : 08 GPS Map Datum : GPS Date Stamp : 2008:04:27 GPS Altitude : 353 m Above Sea Level GPS Date/Time : 2008:04:27 06:24:57Z GPS Latitude : 25 deg 1' 10.80" S GPS Longitude : 31 deg 29' 49.20" E GPS Position : 25 deg 1' 10.80" S, 31 deg 29' 49.20" E $ grep GPS after GPS Latitude Ref : South GPS Altitude Ref : Above Sea Level GPS Time Stamp : 06:24:57 GPS Satellites : 08 GPS Map Datum : GPS Date Stamp : 2008:04:27 GPS Altitude : 353 m Below Sea Level GPS Date/Time : 2008:04:27 06:24:57Z GPS Latitude : 25 deg 1' 10.80" S GPS Longitude : 31 deg 29' 49.20" E GPS Longitude Ref : East GPS Position : 25 deg 1' 10.80" S, 31 deg 29' 49.20" E One bug left concerning GPS fields: "353 m Above Sea Level" becomes "353 m Below Sea Level".
Does GIMP do such specific changes, or is this a problem in libexif?
Let's assume this is fixed in master, please reopen if it isn't. commit 21bed1e2fb438fa5721bddb0573a724ae0024455 Author: Hartmut Kuhse <onkelhatti@gimp.org> Date: Sat Oct 19 18:38:01 2013 +0200 Completely rewrite metadata handling using gexiv2 Based on original patches from Hartmut Kuhse and modified by Michael Natterer. Changes include: - remove libexif dependency and add a hard dependency on gexiv2 - typedef GExiv2Metadata to GimpMetadata to avoid having to include gexiv2 globally - add basic GimpMetadata handling functions to libgimpbase - add image and image file specific metadata functions to libgimp, including the exif orientation image rotate dialog - port plug-ins to use the new APIs - port file-tiff-save's UI to GtkBuilder - add new plug-in "metadata" to view the image's metadata - keep metadata around as GimpImage member in the core - update the image's metadata on image size, resolution and precision changes - obsolete the old metadata parasites - migrate the old parasites to new GimpMetadata object on XCF load