From cf75e90e480c3685e24d206028d68f548d829d68 Mon Sep 17 00:00:00 2001 From: Kishor Gandham Date: Wed, 17 Jan 2018 11:52:57 +0530 Subject: [PATCH] Fix image crop during embed --- resizer.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resizer.go b/resizer.go index ddd4127..eaf5df5 100644 --- a/resizer.go +++ b/resizer.go @@ -446,7 +446,11 @@ func imageCalculations(o *Options, inWidth, inHeight int) float64 { switch { // Fixed width and height case o.Width > 0 && o.Height > 0: - factor = math.Min(xfactor, yfactor) + if o.Crop { + factor = math.Min(xfactor, yfactor) + } else { + factor = math.Max(xfactor, yfactor) + } // Fixed width, auto height case o.Width > 0: if o.Crop {