mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-08 23:18:19 -07:00
Use vips reduce when downscaling
This commit is contained in:
parent
878125c410
commit
dc3286965b
3 changed files with 22 additions and 1 deletions
12
vips.go
12
vips.go
|
|
@ -513,6 +513,18 @@ func vipsShrink(input *C.VipsImage, shrink int) (*C.VipsImage, error) {
|
|||
return image, nil
|
||||
}
|
||||
|
||||
func vipsReduce(input *C.VipsImage, xshrink float64, yshrink float64) (*C.VipsImage, error) {
|
||||
var image *C.VipsImage
|
||||
defer C.g_object_unref(C.gpointer(input))
|
||||
|
||||
err := C.vips_reduce_bridge(input, &image, C.double(xshrink), C.double(yshrink))
|
||||
if err != 0 {
|
||||
return nil, catchVipsError()
|
||||
}
|
||||
|
||||
return image, nil
|
||||
}
|
||||
|
||||
func vipsEmbed(input *C.VipsImage, left, top, width, height int, extend Extend, background Color) (*C.VipsImage, error) {
|
||||
var image *C.VipsImage
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue