[gthumb: 16/20] read the orientation tag as an integer instead of a string
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb: 16/20] read the orientation tag as an integer instead of a string
- Date: Tue, 30 Mar 2010 19:33:28 +0000 (UTC)
commit 57a2ddfa3a81bd179dc4ecbb4aab5f4899947a84
Author: Paolo Bacchilega <paobac src gnome org>
Date: Tue Mar 30 17:17:09 2010 +0200
read the orientation tag as an integer instead of a string
extensions/exiv2_tools/exiv2-utils.cpp | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/extensions/exiv2_tools/exiv2-utils.cpp b/extensions/exiv2_tools/exiv2-utils.cpp
index dfc6cfc..9510b4f 100644
--- a/extensions/exiv2_tools/exiv2-utils.cpp
+++ b/extensions/exiv2_tools/exiv2-utils.cpp
@@ -860,13 +860,11 @@ exiv2_generate_thumbnail (const char *uri,
if (thumb.pData_ != NULL) {
Exiv2::ExifData &ed = image->exifData();
- const char *orientation = ed["Exif.Image.Orientation"].toString().c_str();
+ long orientation = ed["Exif.Image.Orientation"].toLong();
long image_width = ed["Exif.Photo.PixelXDimension"].toLong();
long image_height = ed["Exif.Photo.PixelYDimension"].toLong();
- if (((orientation == NULL) || (strcmp (orientation, "") == 0) || (strcmp (orientation, "1") == 0))
- && (image_width > 0) && (image_height > 0))
- {
+ if ((orientation == 1) && (image_width > 0) && (image_height > 0)) {
GInputStream *stream = g_memory_input_stream_new_from_data (thumb.pData_, thumb.size_, NULL);
pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, NULL);
@@ -897,9 +895,10 @@ exiv2_generate_thumbnail (const char *uri,
/* Set the orientation option to correctly rotate the thumbnail
* in gnome_desktop_thumbnail_factory_generate_thumbnail() */
- const char *orientation = ed["Exif.Image.Orientation"].toString().c_str();
- if ((orientation != NULL) && (strcmp (orientation, "") != 0))
- gdk_pixbuf_set_option (pixbuf, "orientation", orientation);
+ long orientation = ed["Exif.Image.Orientation"].toLong();
+ char *orientation_s = g_strdup_printf ("%ld", orientation);
+ gdk_pixbuf_set_option (pixbuf, "orientation", orientation_s);
+ g_free (orientation_s);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]