diff --git a/CHANGELOG.md b/CHANGELOG.md index b704ee47..f8780164 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog ## [Unreleased] +### Change +- `dpr` processing option doesn't enlarge image unless `enlarge` is true. + ### Fix - Fix Client Hints behavior. `Width` is physical size, so we should divide it by `DPR` value. diff --git a/processing/prepare.go b/processing/prepare.go index 5478bcb3..ecf8a8bb 100644 --- a/processing/prepare.go +++ b/processing/prepare.go @@ -67,6 +67,9 @@ func calcScale(width, height int, po *options.ProcessingOptions, imgtype imagety hshrink = srcH / dstH } + wshrink /= po.Dpr + hshrink /= po.Dpr + if wshrink != 1 || hshrink != 1 { rt := po.ResizingType @@ -120,9 +123,6 @@ func calcScale(width, height int, po *options.ProcessingOptions, imgtype imagety } } - wshrink /= po.Dpr - hshrink /= po.Dpr - if wshrink > srcW { wshrink = srcW }