From 100da304b82cfcf37603620e0796ebd2b7c0ec49 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Tue, 27 Mar 2018 14:41:19 +0200 Subject: [PATCH] do not perform histogram matching if the embedded thumbnail is too small Fixes #4467 --- rtengine/histmatching.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rtengine/histmatching.cc b/rtengine/histmatching.cc index d7e80a759..0faa8c357 100644 --- a/rtengine/histmatching.cc +++ b/rtengine/histmatching.cc @@ -227,6 +227,13 @@ void RawImageSource::getAutoMatchedToneCurve(const ColorManagementParams &cp, st histMatchingCache = outCurve; histMatchingParams = cp; return; + } else if (w * 10 < fw) { + if (settings->verbose) { + std::cout << "histogram matching: the embedded thumbnail is too small: " << w << "x" << h << std::endl; + } + histMatchingCache = outCurve; + histMatchingParams = cp; + return; } skip = LIM(skip * fh / h, 6, 10); // adjust the skip factor -- the larger the thumbnail, the less we should skip to get a good match source.reset(thumb->quickProcessImage(neutral, fh / skip, TI_Nearest));