Merge branch 'dev' into metadata-exiv2

This commit is contained in:
Thanatomanic
2021-04-27 09:59:52 +02:00
249 changed files with 22554 additions and 8710 deletions

View File

@@ -184,7 +184,7 @@ void Thumbnail::_generateThumbnailImage ()
tpp = nullptr;
delete [] lastImg;
lastImg = nullptr;
tw = -1;
tw = options.maxThumbnailWidth;
th = options.maxThumbnailHeight;
imgRatio = -1.;
@@ -201,20 +201,20 @@ void Thumbnail::_generateThumbnailImage ()
if (ext == "jpg" || ext == "jpeg") {
infoFromImage (fname);
tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, 1, pparams->wb.equal);
tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, -1, pparams->wb.equal);
if (tpp) {
cfs.format = FT_Jpeg;
}
} else if (ext == "png") {
tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, 1, pparams->wb.equal);
tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, -1, pparams->wb.equal);
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);
tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, -1, pparams->wb.equal);
if (tpp) {
cfs.format = FT_Tiff;
@@ -633,10 +633,13 @@ void Thumbnail::decreaseRef ()
cachemgr->closeThumbnail (this);
}
int Thumbnail::getThumbnailWidth (const int h, const rtengine::procparams::ProcParams *pparams) const
void Thumbnail::getThumbnailSize(int &w, int &h, const rtengine::procparams::ProcParams *pparams)
{
MyMutex::MyLock lock(mutex);
int tw_ = tw;
int th_ = th;
float imgRatio_ = imgRatio;
if (pparams) {
@@ -661,10 +664,16 @@ int Thumbnail::getThumbnailWidth (const int h, const rtengine::procparams::ProcP
}
}
if (imgRatio_ > 0.f) {
return imgRatio_ * h;
if (imgRatio_ > 0.) {
w = imgRatio_ * static_cast<float>(h);
} else {
return tw_ * h / th_;
w = tw_ * h / th_;
}
if (w > options.maxThumbnailWidth) {
const float s = static_cast<float>(options.maxThumbnailWidth) / w;
w = options.maxThumbnailWidth;
h = std::max<int>(h * s, 1);
}
}