Hello all,
was looking for RAW development software and discovered rawstudio. The
program works pretty well so far, but it was impossible for me to save
EXIF data on JPEGs, because the header exceeded the maximum size.
The attached patch solves this by deleting the thumbnail and
MakerNotes, additionally, it adds the "Copy EXIF data" option to the
Flickr plugin.
This may not be the best approach, it would be better to first check
the size of the metadata, also it hasn't been throughly tested, but it
may work if somebody else is having the same problem.

Regards,

Camilo
Index: plugins/output-flickr/output-flickr.c
===================================================================
--- plugins/output-flickr/output-flickr.c	(revision 4096)
+++ plugins/output-flickr/output-flickr.c	(working copy)
@@ -56,6 +56,7 @@
 	gboolean is_public;
 	gboolean is_friend;
 	gboolean is_family;
+    gboolean copy_exif;
 	gint safety_level;
 	gint content_type;
 };
@@ -77,7 +78,8 @@
 	PROP_TAGS,
 	PROP_IS_PUBLIC,
 	PROP_IS_FRIEND,
-	PROP_IS_FAMILY
+	PROP_IS_FAMILY,
+    PROP_COPY_EXIF
 };
 
 static void get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
@@ -145,6 +147,12 @@
 					 g_param_spec_boolean ("family", "family",
 							       _("Visible to Family"), FALSE,
 							       G_PARAM_READWRITE));
+    
+    g_object_class_install_property (object_class, 
+					 PROP_COPY_EXIF,
+					 g_param_spec_boolean ("copy-exif", "copy-exif",
+							       _("Copy EXIF metadata"), TRUE,
+							       G_PARAM_READWRITE));
 
 	g_object_class_install_property (object_class,
 					 PROP_LOGO, g_param_spec_object ("Logo",
@@ -191,6 +199,9 @@
 	case PROP_IS_FAMILY:
 		g_value_set_boolean (value, flickr->is_family);
 		break;
+	case PROP_COPY_EXIF:
+		g_value_set_boolean (value, flickr->copy_exif);
+		break;
 	case PROP_LOGO:
 		g_value_set_object(value, get_logo_widget(flickr));
 		break;
@@ -227,6 +238,9 @@
 	case PROP_IS_FAMILY:
 		flickr->is_family = g_value_get_boolean (value);
 		break;
+	case PROP_COPY_EXIF:
+		flickr->copy_exif = g_value_get_boolean (value);
+		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 	}
@@ -433,7 +447,7 @@
 
 	gchar *temp_file = g_strdup_printf ("%s%s.rawstudio-tmp-%d.jpg", g_get_tmp_dir (), G_DIR_SEPARATOR_S, (gint) (g_random_double () * 10000.0));
 
-	g_object_set (jpegsave, "filename", temp_file, "quality", flickr->quality, NULL);
+	g_object_set (jpegsave, "filename", temp_file, "quality", flickr->quality, "copy-metadata", flickr->copy_exif);
 	rs_output_execute (jpegsave, filter);
 	g_object_unref (jpegsave);
 
Index: librawstudio/rs-exif.cc
===================================================================
--- librawstudio/rs-exif.cc	(revision 4096)
+++ librawstudio/rs-exif.cc	(working copy)
@@ -191,7 +191,19 @@
 
 		/* Set new metadata on output image and save */
 		if (type != RS_EXIF_FILE_TYPE_PNG)
-		  image->setExifData(*data);
+        {
+            std::cout << data->count() << std::endl;
+            Exiv2::ExifThumb exifThumb(*data);
+            std::string thumbExt = exifThumb.extension();
+            if (!thumbExt.empty())
+                exifThumb.erase();
+            Exiv2::ExifData::iterator pos =
+                data->findKey(Exiv2::ExifKey("Exif.Photo.MakerNote"));
+            if (pos != data->end())
+                data->erase(pos);
+            image->setExifData(*data);
+            std::cout << data->count() << std::endl;
+        }
 		image->setIptcData(iptc_data);
 		image->writeMetadata();
 	}
_______________________________________________
Rawstudio-dev mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-dev

Reply via email to