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 303383 - "Save as": (JPEG) exif data not always saved with Preview enabled
"Save as": (JPEG) exif data not always saved with Preview enabled
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Plugins
2.2.x
Other Linux
: High major
: 2.2
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2005-05-07 15:33 UTC by Ari Pollak
Modified: 2008-01-15 12:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to save exif data (515 bytes, patch)
2005-08-13 07:20 UTC, Daniel Guerrero
none Details | Review
Proposed patch (2.64 KB, patch)
2006-01-06 14:20 UTC, Mukund Sivaraman
committed Details | Review

Description Ari Pollak 2005-05-07 15:33:49 UTC
From Debian bug report http://bugs.debian.org/307918:

"save as" does not always save exif data under specific
circumstances.  To reproduce:

- Load an jpeg with exif data.
- CTRL-Shift-S ("save-as"). 
=> "Save Image" dialog:
    - Rename the JPEG as needed.
    - Press "save".
    => "Save as JPEG" dialog
        - Make sure "Show Previw image in window" is selected.
        - Open "Advanced Options" foldout.
        - Note the file size in the dialog.
        - De-Select "Save EXIF data"[1] 
        - Watch the file size shrink ca 10k.
        - Re-Select "Save EXIF data"
        - Observe how the file size does NOT grow!
        - Press "OK"
- Observe that the saved image does not contain any EXIF data (e.g. by using
gqview).

The bug does not appear if  "Show Previw image in window" is
not ON whenever "Save EXIF data" is deselected.  But even a
sequence of:
 - Show Previw image in window" OFF
 - "Save EXIF data" OFF
 - Show Previw image in window" ON 
 - Show Previw image in window" OFF
 - "Save EXIF data" ON
stops the saving of EXIF data!


Workaround:
==========
- Press CTRL-Shift-S or select "save as" from the menu
- continue to "Save as JPEG"/"Advanced Options"
- set "Save EXIF data" ON
- cancel ("Save EXIF data" on will now be the default)
- Use "save as" again.
- either switch off the "Show Previw image in window" or do not
  switch Save EXIF data" OFF unless you want no EXIF data saved.
Comment 1 Sven Neumann 2005-05-08 11:36:10 UTC
Yeah, that code seems to be pretty much broken. At least I don't see any code
that would remove the thumbnail from the EXIF block if "Save thumbnail" is
untoggled.
Comment 2 Ari Pollak 2005-05-08 16:54:34 UTC
Yeah, thumbnails actually aren't affected, just the rest of the EXIF data.
Comment 3 Daniel Guerrero 2005-08-13 07:20:43 UTC
Created attachment 50639 [details] [review]
patch to save exif data
Comment 4 Daniel Guerrero 2005-08-13 07:21:42 UTC
The problem is in the line 422 of the jpeg-save.c, the code is:

if ( (! jsvals.save_exif) || (! exif_data))
    exif_data = exif_data_new ();

and should be:

if ( (! jsvals.save_exif) || (! exif_data))
{
    if (!preview)
        exif_data = exif_data_new ();
}

the reason is simple, whe you select the "show preview", each time you
(de)select the option, calls to save_image, but with preview = TRUE; which
actually causes to delete the exif_data struct =).

Of course now don't update the image size selecting or don't selecting to save
the exif data.

I send in the attachment my patch, I'll watching for comments, because it's my
first patch =S

---
Sorry I have to learn to use bugzilla, my patch is in the other message =)
Comment 5 Sven Neumann 2005-09-09 17:19:24 UTC
This patch might also fix bug #315638. It would probably be a good idea to also
look at that bug report when testing the effect of this patch.
Comment 6 weskaggs 2005-09-13 18:45:32 UTC
Thanks for trying, but the patch in comment #3 does not work correctly, and can
cause the plug-in to crash.  I believe this problem was caused by the changes
that appeared in version 1.119 of jpeg-save.c (which was part of jpeg.c then),
with the following ChangeLog entry:

2004-11-17  Michael Natterer  <mitch@gimp.org>

	* plug-ins/common/jpeg.c: applied (modified) patch from S. Mukund
	which adds EXIF thumbnail loading and saving.
	Fixes bugs #155761 and #158190.

I am trying to understand the logic of those changes, which seems a bit odd to
me at the moment.
Comment 7 Mukund Sivaraman 2006-01-06 14:20:35 UTC
Created attachment 56863 [details] [review]
Proposed patch

This bug was caused as the existing ExifData structure was replaced by a new one if Save EXIF checkbox was unchecked and thumbnail saving was enabled as it requires an initialized EXIF structure.

The problem was that the global ExifData variable was being initialized to a fresh  structure. So when the Save EXIF was toggled back on and the preview code ran, it used the new initialized EXIF structure. This problem only occurs when the preview is on as the save function is called more than once. The patch fixes it.
Comment 8 Sven Neumann 2006-01-06 14:38:09 UTC
Applied to both branches, closing as FIXED.

2006-01-06  Sven Neumann  <sven@gimp.org>

        * plug-ins/common/jpeg.c: applied a patch from Mukund that fixes
        handling of EXIF data when preview is enabled (bug #303383).
Comment 9 Akkana Peck 2006-01-24 19:31:36 UTC
With a build updated Jan 24 2006, GIMP is still not saving exif (was also true with one updated on the 14th).

- Open a jpeg.
- Save as.
- Click on Preview.
- Click ok.
- Verify with jhead that the original had lots of exif info which is not in the saved version.
Comment 10 Akkana Peck 2006-01-24 19:38:57 UTC
Actually, exif isn't saved even if I don't have preview enabled. Should that be in a separate bug, perhaps bug 315638?
Comment 11 Akkana Peck 2006-01-24 21:17:54 UTC
Sorry about those comments. It was pilot error: it turns out I didn't have libexif-dev installed, and configure wasn't warning me about it in any visible way. (I could swear gimp used to print a summary of enabled/disabled features at the end of configure, but no one else seems to remember that and it's certainly not there now.) EXIF saving does indeed work now.
Comment 12 Michael Schumacher 2006-01-24 21:37:00 UTC
Let's go back to resolved then.
Comment 13 Sven Neumann 2006-01-27 00:44:06 UTC
It would indeed be nice if gimp's configure script would output a summary of enabled/disabled features but it never did that. If you want to contribute the changes to the configure script (you could for look at DirectFB's configure script as an example), that would be very much appreciated.
Comment 14 Akkana Peck 2006-01-29 20:19:57 UTC
Okay, I've checked in a first pass at printing a table of features in configure.in. (Commenting here rather than filing a new bug.)