Fix: Crop is doing resize. Closes #128

This commit is contained in:
Dan Persa 2017-01-13 16:13:51 +01:00
parent e099e4c9f5
commit 9b6989c3ce
2 changed files with 14 additions and 6 deletions

View file

@ -401,12 +401,20 @@ func imageCalculations(o *Options, inWidth, inHeight int) float64 {
}
// Fixed width, auto height
case o.Width > 0:
factor = xfactor
o.Height = roundFloat(float64(inHeight) / factor)
if o.Crop {
o.Height = inHeight
} else {
factor = xfactor
o.Height = roundFloat(float64(inHeight) / factor)
}
// Fixed height, auto width
case o.Height > 0:
factor = yfactor
o.Width = roundFloat(float64(inWidth) / factor)
if o.Crop {
o.Width = inWidth
} else {
factor = yfactor
o.Width = roundFloat(float64(inWidth) / factor)
}
// Identity transform
default:
o.Width = inWidth