mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-07 21:48:13 -08:00
transformImage: apply gaussian blur if needed
This commit is contained in:
parent
404cbf902f
commit
4cc9e0dde1
1 changed files with 9 additions and 1 deletions
10
resize.go
10
resize.go
|
|
@ -135,7 +135,8 @@ func normalizeOperation(o *Options, inWidth, inHeight int) {
|
|||
|
||||
func shouldTransformImage(o Options, inWidth, inHeight int) bool {
|
||||
return o.Force || (o.Width > 0 && o.Width != inWidth) ||
|
||||
(o.Height > 0 && o.Height != inHeight) || o.AreaWidth > 0 || o.AreaHeight > 0
|
||||
(o.Height > 0 && o.Height != inHeight) || o.AreaWidth > 0 || o.AreaHeight > 0 ||
|
||||
o.GaussianBlur.Sigma > 0 || o.GaussianBlur.MinAmpl > 0
|
||||
}
|
||||
|
||||
func transformImage(image *C.VipsImage, o Options, shrink int, residual float64) (*C.VipsImage, error) {
|
||||
|
|
@ -172,6 +173,13 @@ func transformImage(image *C.VipsImage, o Options, shrink int, residual float64)
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if o.GaussianBlur.Sigma > 0 || o.GaussianBlur.MinAmpl > 0 {
|
||||
image, err = vipsGaussianBlur(image, o.GaussianBlur)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
debug("Transform: shrink=%v, residual=%v, interpolator=%v",
|
||||
shrink, residual, o.Interpolator.String())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue