Skip to content

Commit d67c48e

Browse files
authored
Merge pull request #224 from kishorgandham/patch-1
Fix image crop during embed
2 parents 7f4a97c + cf75e90 commit d67c48e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

resizer.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,11 @@ func imageCalculations(o *Options, inWidth, inHeight int) float64 {
443443
switch {
444444
// Fixed width and height
445445
case o.Width > 0 && o.Height > 0:
446-
factor = math.Min(xfactor, yfactor)
446+
if o.Crop {
447+
factor = math.Min(xfactor, yfactor)
448+
} else {
449+
factor = math.Max(xfactor, yfactor)
450+
}
447451
// Fixed width, auto height
448452
case o.Width > 0:
449453
if o.Crop {

0 commit comments

Comments
 (0)