Skip to content

Commit

Permalink
Switching to QImageReader for parsing a path to a QImage, and allowin…
Browse files Browse the repository at this point in the history
…g the AutoTransform property correctly handle exif metadata (flipping and orientation of images)
  • Loading branch information
jonoomph committed Feb 1, 2021
1 parent 0d522e1 commit 7636a0b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/QtImageReader.cpp
Expand Up @@ -38,6 +38,7 @@
#include <QtGui/QImage>
#include <QtGui/QPainter>
#include <QtGui/QIcon>
#include <QtGui/QImageReader>

#if USE_RESVG == 1
// If defined and found in CMake, utilize the libresvg for parsing
Expand Down Expand Up @@ -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<QImage>();
loaded = image->load(path);
QImageReader imgReader( path );
imgReader.setAutoTransform( true );
loaded = imgReader.read(image.get());
}

if (!loaded) {
Expand Down

0 comments on commit 7636a0b

Please sign in to comment.