summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Koller <kollix@aon.at>2016-10-26 16:51:11 (GMT)
committerMartin Koller <kollix@aon.at>2016-10-26 16:51:11 (GMT)
commita149002600d8d697fa7136488f0d4703054a3a4c (patch)
treea74124874af46ba54fb02888c5c3e9a1ce8e8ece
parent132b516d04e54f22426b060a68430b7c774328f6 (diff)
Respect EXIF rotation information on loading an image
BUG: 252003 FIXED-IN: 16.12
-rw-r--r--CMakeLists.txt5
-rw-r--r--document/kpDocument_Open.cpp7
2 files changed, 9 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 584f040..4039ac6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,7 +22,7 @@ find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
)
find_package(KF5 REQUIRED COMPONENTS
- KDELibs4Support
+ KDELibs4Support KExiv2
)
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
@@ -36,9 +36,9 @@ else(KF5Sane_FOUND)
add_definitions(-DHAVE_KSANE=0)
endif(KF5Sane_FOUND)
-
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
+ ${KEXIV2_INCLUDE_DIR}
)
# KDE Application Version, managed by release script
@@ -323,6 +323,7 @@ add_executable(kolourpaint ${kolourpaint_SRCS})
target_link_libraries(kolourpaint
KF5::KDELibs4Support
+ KF5::KExiv2
${KSANE_LIBRARIES}
kolourpaint_lgpl
)
diff --git a/document/kpDocument_Open.cpp b/document/kpDocument_Open.cpp
index d900560..dd5bff0 100644
--- a/document/kpDocument_Open.cpp
+++ b/document/kpDocument_Open.cpp
@@ -45,6 +45,7 @@
#include "views/manager/kpViewManager.h"
#include <math.h>
+#include <kexiv2/kexiv2.h>
#include <qcolor.h>
#include <qimage.h>
@@ -55,7 +56,7 @@
#include <kio/netaccess.h>
#include <klocale.h>
#include <kmessagebox.h>
-#include <kmimetype.h> // TODO: isn't this in KIO?
+#include <kmimetype.h>
//---------------------------------------------------------------------
@@ -161,6 +162,10 @@ QImage kpDocument::getPixmapFromFile(const QUrl &url, bool suppressDoesntExistDi
// on the extension, but findByContent() correctly detects
// it as a PNG.
image = QImage (tempFile);
+
+ KExiv2Iface::KExiv2 exif(tempFile);
+ exif.rotateExifQImage(image, exif.getImageOrientation());
+
KIO::NetAccess::removeTempFile (tempFile);
}