From df39e13cf7f50654f8aa9f19d2d6d8efcce46fdf Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Mon, 16 Sep 2019 01:30:52 -0700 Subject: [PATCH] properly handle exif orientation translate the tag value to string using the exiftool way, to be compatible with RT. Fixes issue #4 (cherry picked from commit a4621f54b2ac82b679cf9d865a0a3e4a2ed9c468) --- rtengine/imagedata.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/rtengine/imagedata.cc b/rtengine/imagedata.cc index 2434fc42b..3b61d2baa 100644 --- a/rtengine/imagedata.cc +++ b/rtengine/imagedata.cc @@ -256,7 +256,23 @@ FramesData::FramesData(const Glib::ustring &fname) : } if (find_tag(Exiv2::orientation)) { - orientation = validateUft8(pos->print(&exif)); // validateUft8 (#5923) still needed? + static const std::vector ormap = { + "Unknown", + "Horizontal (normal)", + "Mirror horizontal", + "Rotate 180", + "Mirror vertical", + "Mirror horizontal and rotate 270 CW", + "Rotate 90 CW", + "Mirror horizontal and rotate 90 CW", + "Rotate 270 CW", + "Unknown" + }; + auto idx = pos->toLong(); + if (idx >= 0 && idx < long(ormap.size())) { + orientation = ormap[idx]; + } + //orientation = pos->print(&exif); } if (find_tag(Exiv2::lensName)) {