From 7636a0b1652115f70694ba7736d4c6fd59ea4da7 Mon Sep 17 00:00:00 2001 From: Jonathan Thomas Date: Mon, 1 Feb 2021 15:57:41 -0600 Subject: [PATCH] Switching to QImageReader for parsing a path to a QImage, and allowing the AutoTransform property correctly handle exif metadata (flipping and orientation of images) --- src/QtImageReader.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/QtImageReader.cpp b/src/QtImageReader.cpp index 01b023259..29243ed45 100644 --- a/src/QtImageReader.cpp +++ b/src/QtImageReader.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #if USE_RESVG == 1 // If defined and found in CMake, utilize the libresvg for parsing @@ -75,8 +76,12 @@ void QtImageReader::Open() if (!loaded) { // Attempt to open file using Qt's build in image processing capabilities + // AutoTransform enables exif data to be parsed and auto transform the image + // to the correct orientation image = std::make_shared(); - loaded = image->load(path); + QImageReader imgReader( path ); + imgReader.setAutoTransform( true ); + loaded = imgReader.read(image.get()); } if (!loaded) {