From 9b65b7257d8daad2b5ce78cfa341fa37ca9438e3 Mon Sep 17 00:00:00 2001 From: DarthSim Date: Tue, 18 Apr 2023 18:52:20 +0300 Subject: [PATCH] Apply dprScale after min width/height --- processing/prepare.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/processing/prepare.go b/processing/prepare.go index ba475527..d72ac9af 100644 --- a/processing/prepare.go +++ b/processing/prepare.go @@ -113,9 +113,6 @@ func calcScale(width, height int, po *options.ProcessingOptions, imgtype imagety dprScale = math.Min(dprScale, math.Min(wshrink, hshrink)) } - wshrink /= dprScale - hshrink /= dprScale - if po.MinWidth > 0 { if minShrink := srcW / float64(po.MinWidth); minShrink < wshrink { hshrink /= wshrink / minShrink @@ -130,6 +127,9 @@ func calcScale(width, height int, po *options.ProcessingOptions, imgtype imagety } } + wshrink /= dprScale + hshrink /= dprScale + if wshrink > srcW { wshrink = srcW }