[tracker/libtracker-extract-fixes] tracker-extract: Fixes NB#161047: X/Y resolution of images
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/libtracker-extract-fixes] tracker-extract: Fixes NB#161047: X/Y resolution of images
- Date: Tue, 13 Apr 2010 15:37:43 +0000 (UTC)
commit 2a769d4b3fb71bdcd416780a6bbb20cf2b1341eb
Author: Philip Van Hoof <philip codeminded be>
Date: Tue Apr 13 17:36:09 2010 +0200
tracker-extract: Fixes NB#161047: X/Y resolution of images
src/tracker-extract/tracker-extract-jpeg.c | 14 ++++++++------
src/tracker-extract/tracker-extract-png.c | 17 +++++++++++++++++
src/tracker-extract/tracker-extract-tiff.c | 16 ++++++++++++++++
3 files changed, 41 insertions(+), 6 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-jpeg.c b/src/tracker-extract/tracker-extract-jpeg.c
index 421d79e..7bf2a04 100644
--- a/src/tracker-extract/tracker-extract-jpeg.c
+++ b/src/tracker-extract/tracker-extract-jpeg.c
@@ -72,6 +72,8 @@ typedef struct {
const gchar *state;
const gchar *address;
const gchar *country;
+ const gchar *xres;
+ const gchar *yres;
} MergeData;
static void extract_jpeg (const gchar *filename,
@@ -572,18 +574,18 @@ extract_jpeg (const gchar *uri,
tracker_sparql_builder_object_blank_close (metadata);
}
- if (ed->x_resolution) {
- gdouble value;
+ if (cinfo.density_unit != 0 || ed->x_resolution) {
+ gint value;
- value = g_strtod (ed->x_resolution, NULL);
+ value = cinfo.density_unit != 0 ? cinfo.X_density : atoi (ed->x_resolution);
tracker_sparql_builder_predicate (metadata, "nfo:horizontalResolution");
tracker_sparql_builder_object_int64 (metadata, (gint64) value);
}
- if (ed->y_resolution) {
- gdouble value;
+ if (cinfo.density_unit != 0 || ed->y_resolution) {
+ gint value;
- value = g_strtod (ed->y_resolution, NULL);
+ value = cinfo.density_unit != 0 ? cinfo.Y_density : atoi (ed->y_resolution);
tracker_sparql_builder_predicate (metadata, "nfo:verticalResolution");
tracker_sparql_builder_object_int64 (metadata, (gint64) value);
}
diff --git a/src/tracker-extract/tracker-extract-png.c b/src/tracker-extract/tracker-extract-png.c
index a7913e0..f743ec2 100644
--- a/src/tracker-extract/tracker-extract-png.c
+++ b/src/tracker-extract/tracker-extract-png.c
@@ -468,6 +468,23 @@ read_metadata (TrackerSparqlBuilder *preupdate,
tracker_sparql_builder_object_blank_close (metadata);
}
+ if (ed->x_resolution) {
+ gint value;
+
+ value = atoi (ed->x_resolution);
+ tracker_sparql_builder_predicate (metadata, "nfo:horizontalResolution");
+ tracker_sparql_builder_object_int64 (metadata, (gint64) value);
+ }
+
+ if (ed->y_resolution) {
+ gint value;
+
+ value = atoi (ed->y_resolution);
+ tracker_sparql_builder_predicate (metadata, "nfo:verticalResolution");
+ tracker_sparql_builder_object_int64 (metadata, (gint64) value);
+ }
+
+ tracker_exif_free (ed);
tracker_xmp_free (xd);
g_free (pd.creation_time);
g_free (md.camera);
diff --git a/src/tracker-extract/tracker-extract-tiff.c b/src/tracker-extract/tracker-extract-tiff.c
index b17087e..cc114ee 100644
--- a/src/tracker-extract/tracker-extract-tiff.c
+++ b/src/tracker-extract/tracker-extract-tiff.c
@@ -676,6 +676,22 @@ extract_tiff (const gchar *uri,
g_free (uri);
}
+ if (ed->x_resolution) {
+ gint value;
+
+ value = atoi (ed->x_resolution);
+ tracker_sparql_builder_predicate (metadata, "nfo:horizontalResolution");
+ tracker_sparql_builder_object_int64 (metadata, (gint64) value);
+ }
+
+ if (ed->y_resolution) {
+ gint value;
+
+ value = atoi (ed->y_resolution);
+ tracker_sparql_builder_predicate (metadata, "nfo:verticalResolution");
+ tracker_sparql_builder_object_int64 (metadata, (gint64) value);
+ }
+
g_free (md.camera);
tiff_data_free (&td);
tracker_exif_free (ed);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]