mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-13 09:20:29 -07:00
Added interface and test for sharpen
This commit is contained in:
parent
13ef72dc03
commit
99abaf0752
5 changed files with 57 additions and 3 deletions
13
resize.go
13
resize.go
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue