Merge pull request #6367 from xiota/jxl-import
Add ability to import JXL images
This commit is contained in:
@@ -226,13 +226,12 @@ Glib::ustring Thumbnail::xmpSidecarPath(const Glib::ustring &imagePath)
|
||||
return rtengine::Exiv2Metadata::xmpSidecarPath(imagePath);
|
||||
}
|
||||
|
||||
void Thumbnail::_generateThumbnailImage ()
|
||||
void Thumbnail::_generateThumbnailImage()
|
||||
{
|
||||
|
||||
// delete everything loaded into memory
|
||||
delete tpp;
|
||||
tpp = nullptr;
|
||||
delete [] lastImg;
|
||||
delete[] lastImg;
|
||||
lastImg = nullptr;
|
||||
tw = options.maxThumbnailWidth;
|
||||
th = options.maxThumbnailHeight;
|
||||
@@ -249,64 +248,55 @@ void Thumbnail::_generateThumbnailImage ()
|
||||
cfs.exifValid = false;
|
||||
cfs.timeValid = false;
|
||||
|
||||
if (ext == "jpg" || ext == "jpeg") {
|
||||
infoFromImage (fname);
|
||||
tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, -1, pparams->wb.equal, pparams->wb.observer);
|
||||
// RAW works like this:
|
||||
// 1. if we are here it's because we aren't in the cache so load the JPG
|
||||
// image out of the RAW. Mark as "quick".
|
||||
// 2. if we don't find that then just grab the real image.
|
||||
bool quick = false;
|
||||
|
||||
rtengine::eSensorType sensorType = rtengine::ST_NONE;
|
||||
|
||||
if (initial_ && options.internalThumbIfUntouched) {
|
||||
quick = true;
|
||||
tpp = rtengine::Thumbnail::loadQuickFromRaw(fname, sensorType, tw, th, 1, TRUE);
|
||||
}
|
||||
|
||||
if (!tpp) {
|
||||
quick = false;
|
||||
tpp = rtengine::Thumbnail::loadFromRaw(fname, sensorType, tw, th, 1, pparams->wb.equal, pparams->wb.observer, TRUE, &(pparams->raw));
|
||||
}
|
||||
|
||||
cfs.sensortype = sensorType;
|
||||
|
||||
if (tpp) {
|
||||
cfs.format = FT_Raw;
|
||||
cfs.thumbImgType = quick ? CacheImageData::QUICK_THUMBNAIL : CacheImageData::FULL_THUMBNAIL;
|
||||
infoFromImage(fname);
|
||||
|
||||
if (!quick) {
|
||||
cfs.width = tpp->full_width;
|
||||
cfs.height = tpp->full_height;
|
||||
}
|
||||
}
|
||||
|
||||
if (!tpp) {
|
||||
// this will load formats supported by imagio (jpg, png, jxl, and tiff)
|
||||
tpp = rtengine::Thumbnail::loadFromImage(fname, tw, th, -1, pparams->wb.equal, pparams->wb.observer);
|
||||
|
||||
if (tpp) {
|
||||
cfs.format = FT_Jpeg;
|
||||
}
|
||||
} else if (ext == "png") {
|
||||
tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, -1, pparams->wb.equal, pparams->wb.observer);
|
||||
|
||||
if (tpp) {
|
||||
cfs.format = FT_Png;
|
||||
}
|
||||
} else if (ext == "tif" || ext == "tiff") {
|
||||
infoFromImage (fname);
|
||||
tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, -1, pparams->wb.equal, pparams->wb.observer);
|
||||
|
||||
if (tpp) {
|
||||
cfs.format = FT_Tiff;
|
||||
}
|
||||
} else {
|
||||
// RAW works like this:
|
||||
// 1. if we are here it's because we aren't in the cache so load the JPG
|
||||
// image out of the RAW. Mark as "quick".
|
||||
// 2. if we don't find that then just grab the real image.
|
||||
bool quick = false;
|
||||
|
||||
rtengine::eSensorType sensorType = rtengine::ST_NONE;
|
||||
if ( initial_ && options.internalThumbIfUntouched) {
|
||||
quick = true;
|
||||
tpp = rtengine::Thumbnail::loadQuickFromRaw (fname, sensorType, tw, th, 1, TRUE);
|
||||
}
|
||||
|
||||
if ( tpp == nullptr ) {
|
||||
quick = false;
|
||||
tpp = rtengine::Thumbnail::loadFromRaw (fname, sensorType, tw, th, 1, pparams->wb.equal, pparams->wb.observer, TRUE, &(pparams->raw));
|
||||
}
|
||||
|
||||
cfs.sensortype = sensorType;
|
||||
if (tpp) {
|
||||
cfs.format = FT_Raw;
|
||||
cfs.thumbImgType = quick ? CacheImageData::QUICK_THUMBNAIL : CacheImageData::FULL_THUMBNAIL;
|
||||
infoFromImage (fname);
|
||||
if (!quick) {
|
||||
cfs.width = tpp->full_width;
|
||||
cfs.height = tpp->full_height;
|
||||
}
|
||||
cfs.format = FT_Custom;
|
||||
infoFromImage(fname);
|
||||
}
|
||||
}
|
||||
|
||||
if (tpp) {
|
||||
tpp->getAutoWBMultipliers(cfs.redAWBMul, cfs.greenAWBMul, cfs.blueAWBMul);
|
||||
_saveThumbnail ();
|
||||
_saveThumbnail();
|
||||
cfs.supported = true;
|
||||
|
||||
cfs.save (getCacheFileName ("data", ".txt"));
|
||||
cfs.save(getCacheFileName("data", ".txt"));
|
||||
|
||||
generateExifDateTimeStrings ();
|
||||
generateExifDateTimeStrings();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -761,10 +751,10 @@ rtengine::IImage8* Thumbnail::processThumbImage (const rtengine::procparams::Pro
|
||||
|
||||
MyMutex::MyLock lock(mutex);
|
||||
|
||||
if ( tpp == nullptr ) {
|
||||
if (!tpp) {
|
||||
_loadThumbnail();
|
||||
|
||||
if ( tpp == nullptr ) {
|
||||
if (!tpp) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@@ -798,7 +788,7 @@ rtengine::IImage8* Thumbnail::upgradeThumbImage (const rtengine::procparams::Pro
|
||||
|
||||
_generateThumbnailImage();
|
||||
|
||||
if ( tpp == nullptr ) {
|
||||
if (!tpp) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -1004,7 +994,7 @@ void Thumbnail::_loadThumbnail(bool firstTrial)
|
||||
_loadThumbnail (false);
|
||||
}
|
||||
|
||||
if (tpp == nullptr) {
|
||||
if (!tpp) {
|
||||
return;
|
||||
}
|
||||
} else if (!succ) {
|
||||
|
Reference in New Issue
Block a user