diff --git a/nQuantCpp/GilbertCurve.cpp b/nQuantCpp/GilbertCurve.cpp index 66114de..7094b3e 100644 --- a/nQuantCpp/GilbertCurve.cpp +++ b/nQuantCpp/GilbertCurve.cpp @@ -189,7 +189,7 @@ namespace Peano DITHER_MAX = weight < .01 ? (weight > .0025) ? (BYTE)25 : 16 : 9; auto edge = hasAlpha ? 1 : exp(weight) + .25; ditherMax = (hasAlpha || DITHER_MAX > 9) ? (BYTE)sqr(_sqrt(DITHER_MAX) + edge) : DITHER_MAX; - if (pPalette->Count / weight > 5000 && weight > .01 && pPalette->Count >= 64) + if (pPalette->Count / weight > 5000 && (weight > .045 || (weight > .01 && pPalette->Count <= 64))) ditherMax = (BYTE)sqr(4.75); thresold = DITHER_MAX > 9 ? -112 : -88; auto pWeights = make_unique(DITHER_MAX);