GNOME Bugzilla – Bug 303383
"Save as": (JPEG) exif data not always saved with Preview enabled
Last modified: 2008-01-15 12:53:45 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.
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.
Yeah, thumbnails actually aren't affected, just the rest of the EXIF data.
Created attachment 50639 [details] [review] patch to save exif data
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 =)
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.
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.
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.
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).
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.
Actually, exif isn't saved even if I don't have preview enabled. Should that be in a separate bug, perhaps bug 315638?
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.
Let's go back to resolved then.
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.
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.)