Commit 57a2ddfa authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

read the orientation tag as an integer instead of a string

parent de3280af
......@@ -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);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment