mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-15 10:25:55 -07:00
Support brightness and contrast
This commit is contained in:
parent
d0fb333ce4
commit
76894654c7
4 changed files with 68 additions and 0 deletions
22
vips.go
22
vips.go
|
|
@ -830,3 +830,25 @@ func vipsGamma(image *C.VipsImage, Gamma float64) (*C.VipsImage, error) {
|
|||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func vipsBrightness(image *C.VipsImage, brightness float64) (*C.VipsImage, error) {
|
||||
var out *C.VipsImage
|
||||
defer C.g_object_unref(C.gpointer(image))
|
||||
|
||||
err := C.vips_brightness_bridge(image, &out, C.double(brightness))
|
||||
if err != 0 {
|
||||
return nil, catchVipsError()
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func vipsContrast(image *C.VipsImage, contrast float64) (*C.VipsImage, error) {
|
||||
var out *C.VipsImage
|
||||
defer C.g_object_unref(C.gpointer(image))
|
||||
|
||||
err := C.vips_contrast_bridge(image, &out, C.double(contrast))
|
||||
if err != 0 {
|
||||
return nil, catchVipsError()
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue