Skip to content

Commit

Permalink
Implemented a colorspace conversion in the ImageProvider to stop the
Browse files Browse the repository at this point in the history
image from going tinted.
  • Loading branch information
poetaster committed May 5, 2022
1 parent fb98bcc commit 4790bd0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/ImageProvider.h
Expand Up @@ -87,16 +87,18 @@ class ImageProvider : public QQuickImageProvider
*size = originalSize;

img = ir.read();

QImage converted;
converted = img.convertToFormat(img.Format_RGB888);
NemoImageMetadata meta(filename, format);

if (meta.orientation() != NemoImageMetadata::TopLeft)
img = rotate(img, meta.orientation());
//img = rotate(img, meta.orientation());
converted = rotate(converted, meta.orientation());

if (requestedSize.isValid())
return img.scaled(requestedSize.width(), requestedSize.height(), Qt::KeepAspectRatio);
return converted.scaled(requestedSize.width(), requestedSize.height(), Qt::KeepAspectRatio);
else
return img;
return converted;
}
};

Expand Down

0 comments on commit 4790bd0

Please sign in to comment.