Use lcms2 for color profiles
This commit is contained in:
+13
-9
@@ -13,10 +13,7 @@
|
||||
#include <libxisf.h>
|
||||
#include "rawimage.h"
|
||||
#include "starfit.h"
|
||||
|
||||
#ifdef COLOR_MANAGMENT
|
||||
#include <QColorSpace>
|
||||
#endif
|
||||
#include <lcms2.h>
|
||||
|
||||
LoadRunable::LoadRunable(const QString &file, Image *receiver, AnalyzeLevel level, bool thumbnail) :
|
||||
m_file(file),
|
||||
@@ -339,11 +336,13 @@ bool loadXISF(const QString &path, ImageInfoData &info, std::shared_ptr<RawImage
|
||||
{
|
||||
image = std::make_shared<RawImage>(tmpImage.width(), tmpImage.height(), 1, type);
|
||||
std::memcpy(image->data(), tmpImage.imageData(), tmpImage.imageDataSize() / tmpImage.channelCount());
|
||||
image->setICCProfile(tmpImage.iccProfile());
|
||||
return true;
|
||||
}
|
||||
else if(tmpImage.channelCount() == 3 || tmpImage.channelCount() == 4)
|
||||
{
|
||||
image = RawImage::fromPlanar(tmpImage.imageData(), tmpImage.width(), tmpImage.height(), tmpImage.channelCount(), type);
|
||||
image->setICCProfile(tmpImage.iccProfile());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -380,6 +379,10 @@ void LoadRunable::run()
|
||||
{
|
||||
rawImage->convertToGLFormat();
|
||||
timer.start();
|
||||
rawImage->generateLUT();
|
||||
qDebug() << "generate LUT" << timer.restart();
|
||||
//rawImage->convertTosRGB();
|
||||
//qDebug() << "convert" << timer.restart();
|
||||
rawImage->calcStats();
|
||||
const RawImage::Stats &stats = rawImage->imageStats();
|
||||
qDebug() << "image stats" << timer.restart();
|
||||
@@ -426,7 +429,12 @@ void LoadRunable::run()
|
||||
}
|
||||
catch(std::exception e)
|
||||
{
|
||||
qDebug() << m_file << e.what();
|
||||
qDebug() << m_file << e.what();
|
||||
std::shared_ptr<RawImage> rawImage;
|
||||
if(m_thumbnail)
|
||||
QMetaObject::invokeMethod(m_receiver, "thumbnailLoadFinish", Qt::QueuedConnection, Q_ARG(std::shared_ptr<RawImage>, rawImage));
|
||||
else
|
||||
QMetaObject::invokeMethod(m_receiver, "imageLoaded", Qt::QueuedConnection, Q_ARG(std::shared_ptr<RawImage>, rawImage), Q_ARG(ImageInfoData, ImageInfoData()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -497,10 +505,6 @@ bool loadImage(const QString &path, ImageInfoData &info, std::shared_ptr<RawImag
|
||||
else
|
||||
{
|
||||
QImage img(path);
|
||||
#ifdef COLOR_MANAGMENT
|
||||
if(img.colorSpace().isValid() && img.colorSpace() != QColorSpace::SRgb)
|
||||
img.convertToColorSpace(QColorSpace::SRgb);
|
||||
#endif
|
||||
|
||||
ExifData *exif = exif_data_new_from_file(path.toLocal8Bit().constData());
|
||||
info.info.append({QObject::tr("Width"), QString::number(img.width())});
|
||||
|
||||
Reference in New Issue
Block a user