Added interface and test for sharpen

This commit is contained in:
Chuck Neerdaels 2015-11-16 15:46:08 -08:00
parent 13ef72dc03
commit 99abaf0752
5 changed files with 57 additions and 3 deletions

View file

@ -149,7 +149,7 @@ func shouldTransformImage(o Options, inWidth, inHeight int) bool {
}
func shouldApplyEffects(o Options) bool {
return o.GaussianBlur.Sigma > 0 || o.GaussianBlur.MinAmpl > 0
return o.GaussianBlur.Sigma > 0 || o.GaussianBlur.MinAmpl > 0 || o.Sharpen.Radius > 0 && o.Sharpen.Y2 > 0 || o.Sharpen.Y3 > 0
}
func transformImage(image *C.VipsImage, o Options, shrink int, residual float64) (*C.VipsImage, error) {
@ -202,8 +202,15 @@ func applyEffects(image *C.VipsImage, o Options) (*C.VipsImage, error) {
}
}
debug("Effects: gaussSigma=%v, gaussMinAmpl=%v",
o.GaussianBlur.Sigma, o.GaussianBlur.MinAmpl)
if o.Sharpen.Radius > 0 && o.Sharpen.Y2 > 0 || o.Sharpen.Y3 > 0 {
image, err = vipsSharpen(image, o.Sharpen)
if err != nil {
return nil, err
}
}
debug("Effects: gaussSigma=%v, gaussMinAmpl=%v, sharpenRadius=%v",
o.GaussianBlur.Sigma, o.GaussianBlur.MinAmpl, o.Sharpen.Radius)
return image, nil
}