mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-14 18:05:55 -07:00
Merge pull request #374 from Mereng/brightness_contrast
Support brightness and contrast
This commit is contained in:
commit
ffadb9e4b0
4 changed files with 68 additions and 0 deletions
22
vips.go
22
vips.go
|
|
@ -847,3 +847,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