After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 377917 - exif GPS data is removed from, when saving a jpeg with exif data
exif GPS data is removed from, when saving a jpeg with exif data
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Plugins
2.2.x
Other All
: Normal minor
: 2.4
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2006-11-21 21:12 UTC by Gert Vervoort
Modified: 2008-01-15 13:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
jpeg file with GPS information in the exif data (15.17 KB, image/jpeg)
2006-11-21 21:14 UTC, Gert Vervoort
Details

Description Gert Vervoort 2006-11-21 21:12:26 UTC
Please describe the problem:
When saving a jpeg file with exif data of which the original jpeg image contains GPS data in the exif information, then the exif GPS information is not saved to the output jpeg image.



Steps to reproduce:
1. Open an jpeg image with exif informtion which include GPS data
2. do some modifications.....
3. Save again as a jpeg image with exif data



Actual results:
The GPS information has been removed from the exif data:

[gert@apollo tmp]$ exiftool exif_gps_saved.jpg
ExifTool Version Number         : 6.56
File Name                       : exif_gps_saved.jpg
File Size                       : 15 kB
File Modification Date/Time     : 2006:11:21 22:10:41
File Type                       : JPEG
MIME Type                       : image/jpeg
JFIF Version                    : 1.1
Resolution Unit                 : inches
Modify Date                     : 2006:11:17 21:40:31
Date/Time Original              : 2006:11:04 08:55:27
Create Date                     : 2006:11:04 08:55:27
User Comment                    : Egypte, Luxor - panorama foto van de Pyramide van Cheops in Gizeh
Compression                     : JPEG (old-style)
X Resolution                    : 72
Y Resolution                    : 72
Thumbnail Offset                : 326
Thumbnail Length                : 2460
Image Width                     : 400
Image Height                    : 169
Image Size                      : 400x169
Thumbnail Image                 : (Binary data 2460 bytes, use -b option to extract)
[gert@apollo tmp]$


Expected results:
The GPS data still being present:

[gert@apollo tmp]$ exiftool exif_gps_original.jpg
ExifTool Version Number         : 6.56
File Name                       : exif_gps_original.jpg
File Size                       : 15 kB
File Modification Date/Time     : 2006:11:21 22:01:58
File Type                       : JPEG
MIME Type                       : image/jpeg
Modify Date                     : 2006:11:17 21:40:31
Date/Time Original              : 2006:11:04 08:55:27
Create Date                     : 2006:11:04 08:55:27
User Comment                    : Egypte, Luxor - panorama foto van de Pyramide van Cheops in Gizeh
GPS Version ID                  : 0.0.2.2
GPS Latitude Ref                : North
GPS Latitude                    : 29 deg 58' 44.72"
GPS Longitude Ref               : East
GPS Longitude                   : 31 deg 8' 2.72"
GPS Altitude Ref                : Above Sea Level
GPS Altitude                    : 0 metres
Compression                     : JPEG (old-style)
X Resolution                    : 72
Y Resolution                    : 72
Thumbnail Offset                : 465
Thumbnail Length                : 2515
Image Width                     : 400
Image Height                    : 169
GPS Position                    : 29 deg 58' 44.72" N, 31 deg 8' 2.72" E
Image Size                      : 400x169
Thumbnail Image                 : (Binary data 2515 bytes, use -b option to extract)
[gert@apollo tmp]$


Does this happen every time?
yes

Other information:
Comment 1 Gert Vervoort 2006-11-21 21:14:57 UTC
Created attachment 76993 [details]
jpeg file with GPS information in the exif data

The jpeg file containing GPS information in the exif data, used to reproduce the bug.
Comment 2 Aurimas Juška 2006-11-22 08:53:56 UTC
Isn't it just one of the points of bug 56443?
Comment 3 Sven Neumann 2006-11-22 11:01:52 UTC
GIMP should still preserve the EXIF data and as far as I know the JPEG plug-in attempts to do that. But looking at the console output (from GIMP 2.3), something seems to be not working correctly here:

jpeg-load: found EXIF block (2969 bytes)
jpeg-save: saving EXIF block (20 bytes)

The "Save EXIF data" toggle in the JPEG dialog is insensitive. This might be a completely different problem that exists only in the HEAD branch. But we should definitely try to get this fixed for 2.4.
Comment 4 Mukund Sivaraman 2006-11-24 15:30:35 UTC
The following condition ni plug-ins/jpeg/jpeg-exif.c is causing the EXIF reader to return early without the EXIF data:

  if (! exif_content_get_entry (exif_data->ifd[EXIF_IFD_EXIF],
                                EXIF_TAG_EXIF_VERSION))
    return;


It looks like the supplied image in comment #1 is lacking a ExifVersion field. This field is mandatory according to the EXIF specification and hence the image is broken.

We should handle such images gracefully.

Comment 5 Michael Schumacher 2006-12-07 00:41:25 UTC
What exactly do you have in mind for "gracefully"?
Comment 6 Sven Neumann 2006-12-08 10:31:49 UTC
We should try to preserve the EXIF data. In other words, don't touch it.
Comment 7 Raphaël Quinet 2007-02-16 10:23:37 UTC
Note that some images have broken EXIF data containing an invalid EXIF version number and other strange things that should probably be sanitized by GIMP if possible.  For example, see bug #166248 and my comment (#4) describing the strange contents of that EXIF block.
Comment 8 weskaggs 2007-02-16 16:25:55 UTC
The check shown in comment #4 was added because libexif returns an exif_data structure whether or not the image actually has any exif data, so the structure needs to be checked for validity.  This seemed to me to be a simple and robust way of doing it, which could not fail if the image followed the exif specification, but maybe you can think of a better way.  (This comment is in response to an email from Mukund.)
Comment 9 Mukund Sivaraman 2007-05-02 12:14:27 UTC
Fix implemented in changeset 22377:

2007-05-02  Mukund Sivaraman  <muks@mukund.org>

        * plug-ins/jpeg/jpeg-exif.c: Check if any other IFDs exist before
        rejecting an image's EXIF info. Fixes bug #377917.

Comment 10 Ville Pätsi 2007-05-06 09:22:12 UTC
You forgot to bumb libexif version requirement. Your fix requires a newer libexif.
Comment 11 Sven Neumann 2007-05-06 14:50:35 UTC
The following change fixes the build with libexif < 0.6.13. You should still update, because you might hit this bug again now.

2007-05-06  Sven Neumann  <sven@gimp.org>

        * plug-ins/jpeg/jpeg-exif.c (jpeg_apply_exif_data_to_image): only
        check for EXIF_TAG_GPS_VERSION_ID if it's defined (see bug #377917).
        This tag was added in libexif 0.6.13.